How do I remove browser/auto padding on h-tags?
I allready tried setting h1,h2 and h3 to padding: 0 and margin: 0, but without success.
7 Replies
heading tags does not have a default padding. so padding:0; wont really do anything, but yeah, they do have a default margin on top and bottom. And if you want to set it to 0 it's margin:0; if that does not work, you have defined a margin later on in your document.
Like this, you see my h1 does not have a margin, but my h2 tag does
If you want to remove the empty space above and below text, it's not margin, but you can use this https://medium.com/eightshapes-llc/cropping-away-negative-impacts-of-line-height-84d744e016ce
Medium
Cropping Away Negative Impacts of Line Height
Getting rid of pesky space above and below HTML text
One day we will have
text-box-trim
(used to be called ” leading trim “
, fingers crossed!!Yeah. I remember i did see that somewhere. Not sure if it was KP who talked about it or if i found it somewhere else. But yeah, hopefully we get it one day
@Tok124 (CSS Nerd) thank you!
for the answer
@Tok124 (CSS Nerd) sorry for bothering you again, but is there a way where on could remove the margin on the left? In your example there is still a bit of margin on the left
Its still not really margin. But uhm... I dont know. Ofc, you could use the translate property to move it slightly to the left, but then it's overflowing, so that's probably not the best idea...
Oh I see. It's just that my layout doesn't perfectly aligns, and it annoys me greatly