Centering text in a div

Centering text in a div
0

#1

For example I have an image covering my background, on top of that but lower down on the page I have a div that is background colour white, width is 100% of the page.
I want a paragraph within that div, text aligned center, but only covering say the middle third of the div. With 1 third of space to the left and 1 third of space to right as an example.
How can I make this possible?
Thanks!


#3

text-align: center;

If you want the 30% within the div, use

padding-left: 30%;
padding-right: 30%;

If you want it outside the div, use

margin-left: 30%
margin-right: 30%;


#4

That’s great, works perfectly thanks. Much easier than I expected it to be, thank you.