0
Help me with this frustrating problem
I am coding html and I want "May 3, 2018" to be aligned center. Take a look at my code HTML <div> <p><span class="text-center">May 3, 2018</span><br>I added new content</p> </div> CSS .text-center { text-align: center; } From what I know it will be aligned in center but It always take no effect on the browser. Help me please
3 Réponses
+ 4
Span is an inline element it won't work try to target p element it aligns all the text to the center
<style>
CSS
p {
text-align: center;
}
</style>
<div>
<p><span>May 3, 2018</span><br>I added new content</p>
</div>
+ 1
Thanks guys
0
text-align works with block level elements such as div, p etc. So, follow Lord Krishna.