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

3rd May 2018, 3:52 PM
Joshuel Ernest Q. Simbulan
Joshuel Ernest Q. Simbulan - avatar
3 Respuestas
+ 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>
3rd May 2018, 4:03 PM
Lord Krishna
Lord Krishna - avatar
+ 1
Thanks guys
3rd May 2018, 5:10 PM
Joshuel Ernest Q. Simbulan
Joshuel Ernest Q. Simbulan - avatar
0
text-align works with block level elements such as div, p etc. So, follow Lord Krishna.
3rd May 2018, 4:28 PM
Sachin Artani
Sachin Artani - avatar