Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74846

Center and right align flexbox elements

$
0
0

I would like to have AB and C aligned in the middle.

How can I get D to go completely to the right?

BEFORE:

enter image description here

AFTER:

enter image description here

ul {
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}
li {
  display: flex;
  margin: 1px;
  padding: 5px;
  background: #aaa;
}
li:last-child {
  background: #ddd;
  /* magic to throw to the right*/
}
<ul><li>A</li><li>B</li><li>C</li><li>D</li></ul>

https://jsfiddle.net/z44p7bsx/


Viewing all articles
Browse latest Browse all 74846

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>