I can do percentages of left margin easy, but I can't get this div to center no matter what method I use.
Check it out here: http://www.fahrenheit-hvac.com/thank-you/
I'm trying to get the social div I created to center so as to remain responsive, but all of the solutions I've found online don't work.
Any help is greatly appreciated.
Jason C.
Try this:
#socialInPage {
text-align: center;
margin: 0;
}
#socialInPage a {
display: inline-block;
}
Set a width
on the containing div (div#socialInPage). I used 275px
, and it seemed to work. Then set the left and right margins to auto.
width: 275px;
margin: 0 auto;
So long as the text-align
of parent elements is set to center
, then this method will center elements on your page.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.