How to use "background-image" correctly?

Asked

Viewed 1,207 times

-2

This command below is what I use in the current MENU of my Blog, however I would like to change the look and put a background image in the MENU. how do I do this using "background-image"? where do I save the image to be searched for by the command? how to know the image directory?

#PageList1 ul {
border-top: 2px solid #ccc;
border-bottom: 2px solid #ccc;

2 answers

0

0

level exits and enters img folder

PageList1 ul {
   border-top: 2px solid #ccc; 
   border-bottom: 2px solid #ccc; 
   background-image: url("../img/remove-icon-small.png") !important;
}

same css file level and enters img folder

PageList1 ul {
   border-top: 2px solid #ccc; 
   border-bottom: 2px solid #ccc; 
   background-image: url("/img/remove-icon-small.png") !important;
}

same level of css without entering any folder

PageList1 ul {
   border-top: 2px solid #ccc; 
   border-bottom: 2px solid #ccc; 
   background-image: url("remove-icon-small.png") !important;
}

You should consider the image url according to the folder structure if the image is on the same root as the css file then disregard putting ../ so on and so forth.

  • Sorry, I still don’t understand where to save the image and find your directory, let’s say I want to use this link image as background: https://cdn.pixabay.com/photo/2016/05/21/13/28/banner-1406825_960_720.png. ...as you can see online. what should I do? save where? or can I use the URL? it is really possible to use it as a MENU background?

  • Save the image locally. Voce did not understand the 3 examples I wrote, noticed the difference between the folder levels in relation to your css file?

  • sorry, I’m a beginner in CSS, I have just a notion of how it works but I don’t know the complete structure... I just wanted to be able to use "baground-image", it would make a lot of difference to me today.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.