Jump to content

Recommended Posts

I'm using a stylesheet that has an image within it. What I'd like to do is display a different image in different pages, while all other formatting is the same. Right now, I'm having to replicate the full code below and renaming it. For example, replicate it using #nav2.. nav3, etc. But I need to do this for many pages and it creates unnecessary codes on the css file and increases the file size. What's my alternative in doing this?

 

#nav {
  position: absolute;
  top: 0;
  left: 0;
  width: 252px;
  padding-top: 292px;
  background: url(images/pic_1.jpg) no-repeat; //I'M REFERRING TO THIS IMAGE
}
#nav ul {
  background: bottom right #991111 url(images/nav_bot.jpg) no-repeat;
  margin: 0 7px 0 28px;
  padding: 5px 20px 15px 20px;
}
#nav li {
  list-style: none;
  background: bottom left url(images/dots.jpg) repeat-x;
}
#nav a {
  color: #FDE7C2;
  font: 18px "times new roman", serif;
  font-style: italic;
  background: #991111;
  padding-right: 8px;
}

Link to comment
https://forums.phpfreaks.com/topic/192972-stylesheet-help/
Share on other sites

#nav1,#nav2,#nav3 {
  position: absolute;
  top: 0;
  left: 0;
  width: 252px;
  padding-top: 292px;
}

#nav1 {  background: url(images/pic_1.jpg) no-repeat; }
#nav2{  background: url(images/pic_2.jpg) no-repeat; }
#nav3{  background: url(images/pic_3.jpg) no-repeat;}

 

Like that. You can always group the ids/classes together, and change the rest in their own sections.

Link to comment
https://forums.phpfreaks.com/topic/192972-stylesheet-help/#findComment-1016499
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.