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

I want to ask about CSS reading images in different folders. How to solve it? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:15:261564browse

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


Reply to the discussion (solution)

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,

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn