I am new to HTML and CSS.
I am trying to remove the top and bottom margin from my H1 but the default margin remains.
My CSS so far looks like the below:
font-family: 'Cormorant Garamond';
font-size: 65px;
letter-spacing: 40px;
color: white;
text-align: center;
I have also added tried each of the following:
margin: none;
margin-top: none;
margin-top: 0px;
margin-top: 0%;
margin: 0;
The default margins remain.
Does anyone have any ideas why this could be?
2
Answers
Be sure that there is no padding on the h1 element, perhaps there is some padding which may appear as a margin. So try setting the top and bottom padding to 0.
h1{padding: 0}
or
h1{padding-top: 0;
padding-bottom: 0}.
Check out this as well: Unwanted top margin for h1 element
Try
margin-top: 0px !important;