It is possible to change the direction of the flex line. If we set the direction property to rtl (right-to-left), not only is the text drawn right to left, but the flex line also changes direction, which in turn, can change the entire page layout (usually in unexpected ways):
HTML file: | Displayed by browser: |
---|---|
<style>
body { direction: rtl; } .flex-container { display: -webkit-flex; display: flex; width: 400px; height: 250px; background-color: lightgrey; } .flex-item { background-color: cornflowerblue; width: 100px; height: 100px; margin: 10px; } </style> <body> <div class="flex-container"> <div class="flex-item">flex item 1</div> <div class="flex-item">flex item 2</div> <div class="flex-item">flex item 3</div> </div> <p>The flex items are rendered in reverse with Item 1 at the right. Notice this text and the flex-container are also rendered at the right.</p> </body> |
flex item 1
flex item 2
flex item 3
The flex items are rendered in reverse with Item 1 at the right. Notice that the flex-container and this text are also rendered at the right -- and the last period is out in left field. |
In this document, I applied the directional change only to the right-side cell of the table. If I applied it to the body, EVERYTHING on this page gets reversed, including my back, home and next buttons! It was chaotic!