Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Center HTML Content Horizontally Using CSS

DZone's Guide to

Center HTML Content Horizontally Using CSS

·
Free Resource
Ahh the infamous CSS centering thing... make sure to specify the width and set the right/left margins to 'auto'


#content {
        margin: 0 auto;
        width: 740px;
}


Your HTML would look something like this:


  
This is centered
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}