i cant find an answer anywhere online as i dont believe there's anything in my code that would be putting a space around the hero background image. (this is one of my first times coding with html so please go easy on me lol). i also cant figure out how to reduce the spacing between the <h1> and <h3>.
#cant get rid of white top and sides and space
28 messages · Page 1 of 1 (latest)
@bleak lark many html elements have default styles assigned by the web browser. In particular, all heading and paragraph elements have top and bottom margins by default. That is likely where your white space is coming from.
Try add margin: 0; to your body in the css file.
body { text-align: center; margin: 0; }
thanks guys! @cunning cliff ive just done that and its removed the side margins but still no luck on the top part
That's because the margin attribute only applies to the element itself, not any child elements. If you want to get rid of the margins from the headings and paragraphs, you need to specify that, like this:
body, h1, h2, h3, p {
margin: 0;
}
i added margin: 0 to all elements and still no luck D: also cant seem to adjust spacing between the title and text below
Sidenote: You're also missing a colon on object-fit, it should be object-fit: cover;
thank you
Could you share your scrim or link to code?
chrome-extension://bgcopaeldiliblccidcdolfecjochhad/index.html
Oh no that won't work for anyone else but you.
You did it! Well done. This works.
haha
h1 { margin: 0; }
yayyyy!!!
Which is what @hallow walrus was suggesting. Just as you're learning (I'm also, yay for both of us) of course it's tricky to see.
ahhh i see what you mean now, so i must apply margin values to every single element not just classes?
It depends.
But in short it can be helpful to remove the margins if what is displayed is not what is desired.
thanks so much guys
This would also have worked:
.title { line-height: 4; margin: 0; }
cheers!
i still cant seem to reduce the space between the h1 and h3, i tried putting in line-height for h3 and it only reduced a tinsy bit
It's the line-height on the h1 that is letting you down there.