Quantcast
Channel: CSS center content inside div - Stack Overflow
Viewing all articles
Browse latest Browse all 10

Answer by socha23 for CSS center content inside div

$
0
0

To center a div, set it's width to some value and add margin: auto.

#partners .wrap {    width: 655px;    margin: auto;}

EDIT, you want to center the div contents, not the div itself. You need to change display property of h2, ul and li to inline, and remove the float: left.

#partners li, ul, h2 {    display: inline;    float: none;}

Then, they will be layed out like normal text elements, and aligned according to text-align property of their container, which is what you want.


Viewing all articles
Browse latest Browse all 10

Trending Articles



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