Jump to content

different images on different webpages with CSS?


CNT

Recommended Posts

<head>	<title>Hey</title>	<link rel="Shortcut Icon" href="images/favicon.ico" />	<link rel="stylesheet" type="text/css" href="style.css" /> <style type="text/css">	background-image:url("images/saw.jpg");	background-repeat:no-repeat;	background-attachment:fixed;	background-position:center; </style></head>

What's wrong with above code?What I want to do is (just examples) :1 index.php page has no image10 pages have same image (the "saw.jpg")1 page have "screwdriver.jpg" image1 page have "hammer.jpg" imageLooks like I will have to use "Internal Style Sheet" on every HTML page. Kinda of defend my propose for using menu.php, but it's the only way to do it, right?Chuck

Link to comment
Share on other sites

If each page has a different class on the <body> element, you can target the body of each page using its classname:

<body class="index">

<body class="section1">

And the stylesheet:

body.index {  background-image: url(...);}body.section1{  background-image: url(...);}

Link to comment
Share on other sites

If each page has a different class on the <body> element, you can target the body of each page using its classname:
<body class="index">

<body class="section1">

I see... thank you so much!Quick question (beyond the point)... can I use ID instead of CLASS in this case? Just asking. I know ID is used only once per webpage.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...