Home >Web Front-end >HTML Tutorial >I want to ask about CSS reading images in different folders. How to solve it? _html/css_WEB-ITnose
For example, I have
index.css
and
chanpin/bg.gif
shuoming/bg.gif
I now want to enter the product page and read the chanpin folder The picture
Enter the description page and read the picture in the shuoming folder
But only use this css
Can I write a judgment about this in the css
Thank you
Of course it is unwise to use one css.
You can write 2 css to call different ones when entering different pages. CSS to call different paths
Of course, JS is also needed to call
if(){
document.getElementById("one").style.className= "css1";
}else{
document.getElementById("one").style.className="css2";
}
Thank you LS brother
I just want to know if there is a quick way
Look at it this way, I still need one CSS for each page
Thank you
Of course, the CSS passed by the page is written into one,
If I want something different for each page, just a background image.
In that case, it will be OK to implement the style directly on the page. Sometimes there is no need to deliberately code-behind
Do you want to display two pictures together? Of course this won’t work, then just use PS to make the pictures.
Instead of displaying them together, use two CSS styles to control them.
If the definitions in the css are different, you can adjust different images, but it is more troublesome.
Control the relative path and add reference js,