Search code examples
htmlcssmargin

CSS invalid property value for h4 margin


I want to change matgins of an h4 element with styles.css

In the HTML file, the h4 is nested as this:

main div h4 {
  margin: 20px, 0, 0, 0;
  /* want to change top margin */
}
<main role="main" class="col-12 col-md-9 col-xl-8 py-md-3 pl-md-5">
  <div style="padding-top: 1.0rem;">
    <ul>...</ul>
    <h4 id='sec_summary'>Summary</h4>
  </div>
</main>

The other styles defined in styles.css work fine. But when I was trying to set h4 margin in the way shown above, I tried different numbers and units, the h4's margin doesn't change at all. Why doesn't the code work?


Solution

  • remove , :

    main div h4 {
        margin: 20px 0 0 0; /* want to change top margin */
    }