Background image using css | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Background image using css

I have to put background image using css.Can I set height and width of this image? https://code.sololearn.com/WBj31OmiO0d8/?ref=app

4th Dec 2021, 1:23 PM
๐Ÿ™‚๐Ÿ˜€๐Ÿ˜ƒ
2 Answers
+ 3
CSS background-image Property https://www.w3schools.com/cssref/pr_background-image.asp background-image: url("photographer.jpg"); /* The image used */ background-color: #cccccc; /* Used if the image is unavailable */ height: 500px; /* You must set a specified height */ background-position: center; /* Center the image */ background-repeat: no-repeat; /* Do not repeat the image */ background-size: cover; /* Resize the background image to cover the entire container */
4th Dec 2021, 1:36 PM
SoloProg
SoloProg - avatar
+ 2
Thank you SoloProg
4th Dec 2021, 1:53 PM
๐Ÿ™‚๐Ÿ˜€๐Ÿ˜ƒ