How can I set a header background image? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How can I set a header background image?

I can't do it. I have written #header { background-image: url("htttps://.....") ; But I can't get it to work.

27th Nov 2022, 7:38 PM
Maria Torronteras Torralbo
Maria Torronteras Torralbo - avatar
9 Answers
+ 3
It's done, meaning you've solved your problem or that you've shared your code? I believe what Arturpop means is that you should use the + button and attach your code which isn't working here.
27th Nov 2022, 9:11 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
Share the code so we can take a look at it. 👍
27th Nov 2022, 7:41 PM
Arturop
Arturop - avatar
+ 2
I have solved It. Thank you very much.
27th Nov 2022, 9:55 PM
Maria Torronteras Torralbo
Maria Torronteras Torralbo - avatar
+ 2
Awesome and congratulations
27th Nov 2022, 10:09 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
Use the header tag and in css keep background to that tag ,width is 100% ,height 100vh
29th Nov 2022, 10:14 AM
GANIREDDY NUTHANA VARA PRADEEP
GANIREDDY NUTHANA VARA PRADEEP - avatar
+ 1
It's done
27th Nov 2022, 7:43 PM
Maria Torronteras Torralbo
Maria Torronteras Torralbo - avatar
+ 1
Ok firstly and mostly I would adwise you to write CSS with classes and not id's because if you want to use js you can't name the id and the class the same way because it wouldn't know which to choose, plus I see a typo("htttps" - 3x t), I don't know if it is a mistake when you were writing this or if it was like that when you copied the code but I would recommend you to also write in your header after that line of code background-repeat: no-repeat; and a background-size: cover; This should make the image cover the background. I hope this helps you.
29th Nov 2022, 9:52 AM
GoldenCola
GoldenCola - avatar
0
What did you do to solve it?
29th Nov 2022, 5:38 AM
Kingsley Madu
Kingsley Madu - avatar
0
Inline
29th Nov 2022, 9:29 AM
Saurabh Patel
Saurabh Patel - avatar