-3

I need to center the a paragraf in the CSS. I also want the text to appear horizontial.

<section class="test">
        <div class="test1">
            <p class="result1"> SUCCESS </p11>
            <p class="testnumber1"> TEST# </p12> 
            <p class="date1"> DATE </p13> 
        </div>
</section>

Here is the CSS

p.result1, p.result2 , p.result3, p.result4{
    font-size:12px;
    font-weight:900;
    margin:auto;
}

Any idea?

AAJ
  • 1
  • 2

2 Answers2

2

To center text horizontally apply:

text-align: center;

to the paragraphs that you want to center.

If you want to center the div you just need to provide it a width and set the left and right margins to auto:

width: 20%;
margin: 0 auto;
0

If you want to center the text, you can use the 'text-align'.

p {
    text-align: center;
}

Demo

More info

Try some research by yourself. There is a lot of resource about html and css online.

aloisdg
  • 22,270
  • 6
  • 85
  • 105