Centering with CSS
And some left and right alignment, too!What does "InLine" and "Block Level" Mean?
If something is an inline element that means that it does not normally disrupt the flow of the content. For example, the bold tag is an inline element. It can be used anywhere in a web page and it doesn't cause a line break or anything like that.
On the other hand, a blockquote tag cannot be...
used inline. It will force a line break before and after the blockquote.Blockquote, therefore, is a block-level element.
Some other block-level elements are the header, the div, and the hr tags.
Some examples of inline elements are the italic tag, the link tag, and the span tag.
Centering Inline Elements with CSS
To center an inline element with CSS just use the text-align: center style. Since you will be centering an inline element, and since text is inline, the text-align: center style will work just right. In fact, to align to the left or right just put that in the place of "center" in your code and it wil align to the left or right. In fact, with CSS you can use align: justify, as well.
Here's an example of some code centering the span tag with this method:
<span style="text-align: center;">
Centering Block-Level Elements with CSS
You can center block-level elements with CSS by using the margin style on the auto setting. Just make the left and right margins set to auto.
Take a look at this style applied to a div tag:
<div style="margin-left: auto; margin-right: auto;">



