tags:

views:

347

answers:

3
+17  A: 

CSS:

p {
    text-align: right;
}

INLINE:

<p style="text-align: right">Some Text</p>

jQuery:

$('p').css('text-align', 'right');

Javascript:

var aElements = document.getElementsByTagName('p');
for (var i = 0; i < aElements.length; i++) {
    aElements[i].style.textAlign = 'right';
}
enobrev
Great thanks. I kept seeing vertical-align, but was getting annoyed when I couldn't find horizontal-align.
Xaisoft
Wow, that was a quick pile of points.
Diodeus
great answer giving 4 different solutions and examples, I would lean to the css solution.
Berek Bryan
+6  A: 

It depends. Do you want the entire paragraph to align to the right side of whatever container it's in? Or do you want the text of the paragraph to align to the right margin of the paragraph?

If it's the first, look into the float: right; CSS directive. The latter, text-align: right;

foxxtrot
+5  A: 

Even most experts on CSS use a reference. Find one you like.

http://xhtml.com/en/css/reference/

Jeff Martin
Thanks. I am sure this will be helpful.
Xaisoft