Search code examples
csshtml-heading

Styling via inline style works, styling via external style sheet doesn't


I was trying to remove extra margin/padding around the H1 tag. Suggestions from other posts included setting the top/bottom margins of the H1 tag to 0, using a negative margin, and changing the line-height. Nothing worked...

So I used Firebug to see if it could help. Sure enough there was a margin around the H1 when I looked at the Layout in Firebug. When I changed the number to 0, it added:

style="margin-top:0px; margin-bottom:0px;"

to the H1 tag (as was suggested in other posts) and it fixed the issue. However when I added an entry to the external CSS file to style the H1 tag there, the styling didn't work (i.e. the margin/padding was back).

Does this mean there's a bug in my external CSS?

Thank you!!

Ken


Solution

  • Inline style is the highest priority. Your problem resides in prioritizing your rules.

    Check out This article