You can use
margin-left:autoon an element with fixed width (eg.
width:80%) to center that element. (I used margin property's shorthand version like
margin: 50px auto;)
If you want to center elements contain text like
p, etc. you can use
text-align:center on those elements.
in the example below i created a
div element with a class named "centered" and you can see how i centered the
h2 elements, too. I hope this helps you.
Also i suggest you to check out some html/css tutorials. you can easly find them on the internet. By this way you can learn better.
- answered 2 years ago
- G John