enter image description here
I want to expand this background to reach the edges of the screen to make a heading more clear. Any solutions?
This is the code I am currently using:
body {
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
h1 {
background-color: #4f5d75;
margin: 0;
padding: 0;
text-align: center;
}
html {
margin: 0;
}
<h1>Heading level 1</h1>
I tried using ‘width:’ and ‘height:’ but it only stretches the text or makes the grey move down instead of up. I also tried to set the margin to 0 and nothing happened
New contributor
havacol is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
0
Remove the body’s margin using body { margin: 0; }
.
body {
margin: 0;
}
h1 {
background-color: #4f5d75;
margin-top: 0;
text-align: center;
}
<h1>Heading level 1</h1>
1