Quantcast
Viewing all articles
Browse latest Browse all 1317

How to center a flex container but left-align flex items

I want the flex items to be centered but when we have a second line, to have 5 (from image below) under 1 and not centered in the parent.

Image may be NSFW.
Clik here to view.
enter image description here

Here's an example of what I have:

ul {  display: flex;  flex-direction: row;  flex-wrap: wrap;  justify-content: center;  margin: 0;  padding: 0;}li {  list-style-type: none;  border: 1px solid gray;  margin: 15px;  padding: 5px;  width: 200px;}
<ul><li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li></ul>

http://jsfiddle.net/8jqbjese/2/


Viewing all articles
Browse latest Browse all 1317

Trending Articles



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