html - Why does the text in the span tags not center? -
i not sure why text not center in title class span.
<div id="vid_display"> <span class="title">sampletext</span></br> <span class="desc">sample desc</span> </div>
stylesheet
#vid_display { height: 500px; width: 700px; box-shadow: 10px 10px 5px #888; } .title { font-family: cursive; font-size: 20px; font-style: bold; text-align: center; }
text-align
doesn't have effect on inline elements span tags. need apply text-alignment onto parent element display:block;
<div>
or <p>
wrapping span.
you might better off this:
html
<div id="vid_display"> <p class="title">sampletext</p> <p class="desc">sample desc</p> </div>
css
.title { text-align: center; }
update: here working sample: http://codepen.io/anon/pen/jenys
Comments
Post a Comment