[thelist] Linking to CSS files (not) within the BODY element

Alastair Campbell ac at alastc.com
Wed Jun 7 05:39:30 CDT 2006

Stefan Schwarzer wrote:
> But I have a few pages which need additional
> files.

I don't know enough details to know if this would help, but another way 
round it (for CSS at least) is to add a class to the body based on your 
current location.

You can use PHP to strip the URL down to the first folder and add that 
to the body's class. E.g. the user was in 
http://example.com/events/first_event.php, you could then add "events" 
to the body tag.

Then if you have a standard table border style, but don't want borders 
in the events section, you would have this in the CSS:
.events td, .events th {border-width: 0;}

I use it here to change the header image between some sections and 
change link/table styles:
http://ukwindsurfing.com/ (e.g. news)

I found this a useful standard way to deal with section changes between 
different applications under the same domain.


More information about the thelist mailing list