Heading Alignment? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Heading Alignment?

How do I align a heading in a specific location (left, center, right)? Or is this not allowed?

27th Jan 2017, 5:26 AM
Jose Gabriel Antonio
Jose Gabriel Antonio - avatar
3 Answers
+ 2
All is allowed ;) ( but some things are harder to obtain :\ ) When you talk about 'heading', do you mean <h1>, <h2>... tags, or new HTML5 <header> one? Anyway, they are all 'block' elements, meanings that they size their width as bigger as possible, so you can align the content of the box rather of the box in its parent... since you change it's display property for inlined-kind of... So, headings are classicaly aligned with 'text-align' css property set for their content...
27th Jan 2017, 5:39 AM
visph
visph - avatar
+ 1
<h1 align="center"> <header align="center"> That's it. It's the simplest way to align any div.
27th Jan 2017, 7:07 AM
shashi prakash
shashi prakash - avatar
+ 1
But 'align' attribute is deprecated in Html5... should be done with css ^^
27th Jan 2017, 7:24 AM
visph
visph - avatar