How do I align something in HTML code a certain amount of pixels?

  • Thread starter Thread starter Suzanne F
  • Start date Start date
S

Suzanne F

Guest
Like I want to make something align 150 pixels from the right or something like that help please


(HTML only please)
 
You can only do that kind of precision aligning using CSS. You can put it in with the HTML though (not recommended, but you can).

Say you want to align your paragraphs 150 px from the right, do this:

<p style="position: relative; right: 150px;">Some text here!</p>

You can also change 'right' to 'left', 'top', or 'bottom', and px to %, so maybe you want it 50% from the top you would put "top: 50%;"

The ideal way is to use CSS, however, and I would suggest looking into that if you'll be doing a lot of alignment and design.
 
Back
Top