|
|
 |
Re: FN-FORUM: CSS issues in IE
date posted 31st January 2005 22:02
At 16:54 on Monday, 31 Jan 2005, Luke Perman wrote:
>
> On 31 Jan 2005, at 16:26, Jonathan Clarke wrote:
>
>> Paul, just out of interest how do decide when to use an ID or a Class?
>> It seems to me they do essentially the same thing.
>
> hi jonathan
>
> id is for elements that appear once only on each page, but remain
> consistent throughout the site - it's good to use ID for positioning
> DIVs (#leftcolumn, #centrecontent, etc.) i sometimes also use ID for
> changing images from page to page also, when the positioning remains
> consistent, such as a header graphic, and then simply drop an inline
> style on the page for the background image changes. make sense?
>
what's really cool is to give the body tag an id:
and then you can use contextual selection to style specific elements
depending on which page they are on.
I used that for John's Fruity site:
the CSS:
/*match images with body id - set position as required - left top*/
#home div#content{
background : transparent url(../img/fruit.jpg) no-repeat 248px 148px;
}
#solutions div#content{
background : transparent url(../img/strawberry.jpg) no-repeat 510px 230px;
}
#about div#content{
background : transparent url(../img/bananas.jpg) no-repeat 350px 220px;
}
#contact div#content{
background : transparent url(../img/orange.jpg) no-repeat 30px 188px;
}
#portfolio div#content{
background : transparent url(../img/limes.jpg) no-repeat 30px 158px;
}
http://www.keltecdesign.co.uk/
which makes changing the images easy, if he ever wants to do so...
;o)
|
 |
|