I gave a paragraph a width property because I want it collapsed and not too stretched out horizontally. After I did that, I wanted to align that text to the center, but all it does when I add text-align: center;
is making the direction of paragraph centered.
I need the text itself to be in the center. I tried adding text-align: center;
to the <div>
or p
. Nothing pays off.
Maybe it does not need a specific width? Need help.
.content {
margin: 3cm auto;
text-align: center;
}
.content p {
line-height: normal;
font-size: 16px;
}
#text {
width: 500px;
}
<div class="content">
<div id="text">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam rutrum ex quis hendrerit sagittis. Proin fringilla id sapien suscipit hendrerit. Integer sed diam nec turpis fringilla facilisis id non nulla.</p>
</div>
</div>