Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why justify-content: right only work in firefox?

Tags:

html

css

flexbox

So, i have some code with container as a flex and have justify-content: right; as the property and value in the CSS, and this makes the child element go to right side of container only in firefox, it's weird, because from some references such as CSS-tricks or W3school this value is invalid or it's not exist and the correct value is justify-content: flex-end;. If you see this question from firefox, you must be notice that the text align to the right. Then again, why the justify-content: right; works in firefox? or it's just a bug?

<!DOCTYPE html>
<html>

<head>
  <title>test</title>
  <style>
    section {
      display: flex;
      justify-content: right;
    }
    
    .text {
      width: 50%;
    }
  </style>
</head>

<body>
  <section>
    <div class="text">To change the way a picture fits in your document, click it and a button for layout options appears next to it. When you work on a table, click where you want to add a row or a column, and then click the plus sign. Reading is easier, too, in the new
      Reading view.</div>
  </section>
</body>

</html>
like image 702
owenizedd Avatar asked Nov 28 '17 17:11

owenizedd


1 Answers

See browser compatibility at this page. Firefox is currently the only browser that supports using left and right. Better to stick with flex-end so it works in all browsers.

like image 80
k88lawrence Avatar answered Oct 26 '22 17:10

k88lawrence