How to align the <p> tag?

I have a couple of <p> tags that I want to right justify. Does anyone know how to do this?

+8
html css
source share
3 answers

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'; } 
+26
source share

It depends. Do you want the whole paragraph to match the right side of any container? Or do you want the paragraph text to fit the right edge of the paragraph?

If this is the first, look in float: right; CSS directive. Last one, text-align: right;

+7
source share

You can try to make the correct field equal to zero

0
source share

All Articles