Centering a heading <h1>
css, html
Solution
You can use padding to get a tight border, without setting the h1 as inline (which can't be centered using automatic margins).
h1 {
padding: 0;
width: 35;
margin-left: auto;
margin-right: auto;
// border: ...
}
Problem
Quick question, I have a DIV with a H1 inside it, now , I wish to Center my H1 inside this DIV... I try the following which does not work: set the H1: ``` display:inline margin-left: auto ; margin-right: auto ; ``` But I try this and it does work, can someone explain why the above DOESN'T work? set the H1: ``` width: 35%; margin-left: auto ; margin-right: auto ; ```