Partager via


flexdirection property

Specifies the direction of the main axis which specifies how the flex items are displayed in the flex container.

Note   As of Internet Explorer 11 the Microsoft vendor prefix ("-ms-") version of this property is no longer supported. Instead use the non-prefixed name, flex-direction, which is preferred for better standards compliance and future compatibility.

 

This property is read/write.

 

Syntax

HRESULT put_flexdirection(
  [in]  DOMString val
);

HRESULT get_flexdirection(
  [out] DOMString **ptr
);

Property values

Type: DOMString

String format

row | row-reverse | column | column-reverse

CSS information

Applies To flex containers
Media visual
Inherited no
Initial Value row

Standards information

Remarks

The main axis determines the direction of items placed inside a flex container.

The reverse values do not reverse box ordering like IHTMLCurrentStyle2::writingMode and IHTMLRuleStyle2::direction, they only change the direction of flow. Painting, speech, and sequential navigation orders are not affected.

As of Internet Explorer for Windows Phone 8.1 Update, Internet Explorer for Windows Phone supports the deprecated "-webkit-box-orient" property for interoperability purposes. In the current standard, "-webkit-box-direction and "-webkit-box-orient" are combined as IHTMLCSSStyleDeclaration3::flexdirection.

Examples

The CSS examples and images show the different values for IHTMLCSSStyleDeclaration3::flexdirection using the HTML snippet below. This flex container contains three flex items, has a height of 170 pixels, and a grey border.

<div id="flexContainer">
   <div id="item1">1</div>
   <div id="item2">2</div>
   <div id="item3">3</div>
</div>

In the CSS below, IHTMLCSSStyleDeclaration3::flexdirection is set to row. The flex container's main axis is set to the same orientation as the inline axis of the current writing mode, which for this example is the default, left-to-right.

#flexContainer {
   height: 170px;
   border: solid 1px #949494;
   display: flex;
   flex-direction: row;
}

In the CSS below, IHTMLCSSStyleDeclaration3::flexdirection is set to row-reverse. This example is similar to the row example above, but with the start and end points of the axis reversed.

#flexContainer {
   height: 170px;
   border: solid 1px #949494;
   display: flex;
   flex-direction: row-reverse;
}

In the CSS below, IHTMLCSSStyleDeclaration3::flexdirection is set to column. In this example, the flex container's main axis is set to be the same orientation as the block axis (the vertical axis in horizontal writing modes and the horizontal axis in vertical writing modes) of the current writing mode. Flex items are displayed in the same order that they are declared in the source document, from top to bottom.

#flexContainer {
   height: 170px;
   border: solid 1px #949494;
   display: flex;
   flex-direction: column;
}

In the CSS below, IHTMLCSSStyleDeclaration3::flexdirection is set to column-reverse. This example is similar to the column example above, but the start and end points of the axis reversed.

#flexContainer {
   height: 170px;
   border: solid 1px #949494;
   display: flex;
   flex-direction: column-reverse;
}

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

IHTMLCSSStyleDeclaration3::flexFlow