Date: March 25th, 2012 03:40 am (UTC)
terra: (Default)
From: [personal profile] terra
That's a bit tricker, but yes, it can!! The CSS property for text alignment is text-align:;, so if you want to make a centered paragraph:

<p style="text-align:center;">THIS IS CENTERED TEXT</p>

THIS IS CENTERED TEXT



BUT WAIT, if you try <span style="text-align:right;">RIGHT ALIGNMENT POWERS, ACTIVATE</span>:

RIGHT ALIGNMENT POWERS, ACTIVATE

The results are not impressive. This is because the text-align property only applies to block elements, and span is, by default, an inline element. The easiest way to explain the difference is that block elements take a linebreak by default, whereas inline elements do not. Here is a more in-depth explanation. However, you can use CSS to switch a block element to an inline element and vice versa with the display property. So, if you want to use span to make something align right, this is how it would look:

<span style="text-align:right; display: block;">RIGHT ALIGNMENT POWERS, ACTIVATE</span>RIGHT ALIGNMENT POWERS, ACTIVATE

The answer is, therefore, yes and no.
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Tags