 |

Sola
User
Sep 8, 2003, 9:49 AM
Post #1 of 5
(3031 views)
Shortcut
|
|
Calling a different css file
|
Can't Post
|
|
Hi, Off topic please. Let's say I have a site using a css file. Now, I want an include file (let's say menu.html) to call a DIFFERENT css file, different from the one used by the rest of the website, would anyone know how I can achieve that? In summary, how to make a section of a page call a different css file other than the one being called by the rest of the page. Thank you.
|
|
|  |
 |

Donna
Staff
/ Moderator

Sep 8, 2003, 1:40 PM
Post #2 of 5
(3027 views)
Shortcut
|
|
Re: [Sola] Calling a different css file
[In reply to]
|
Can't Post
|
|
Sola, Nice to hear from you! While it's totally possible to pull in more than one CSS file in a page... I actually can't see the benefit to it, and both CSS files would apply to the entire page. What you might want to do is simply take advantage of CSS classes, which will allow the same tag to do different things. For example, if you have in your CSS file:
p.red {color: #ff0000;} p.blue {color: #0000ff;} ...then in your html:
<p class="red">This text is red</p> <p class="blue">This text is blue</p> ...and that should set it up so that different parts of the page are displayed as you want them to be. By using classes, I can't see any use for having multiple CSS's on the same page. Unless I'm missing something? Let me know if you have some funky use for different stylesheets that I'm not seeing. :) Alternately, you can override any stylesheet by entering it directly into the tag like this:
<p style="color: #ff0000;">This text is red</p> Let me know if that helps, or if you have any other questions! :) Donna
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
|  |
 |

Sola
User
Sep 8, 2003, 3:19 PM
Post #3 of 5
(3024 views)
Shortcut
|
|
Re: [Donna] Calling a different css file
[In reply to]
|
Can't Post
|
|
Thank you for your response. I think I see what I can use here. But to follow up on the last item you posted, is there a way for an include to bypass css that the rest of the page uses? Thanks.
|
|
|  |
 |

Donna
Staff
/ Moderator

Sep 8, 2003, 3:24 PM
Post #4 of 5
(3023 views)
Shortcut
|
|
Re: [Sola] Calling a different css file
[In reply to]
|
Can't Post
|
|
Hi Sola, In general, no. What an include does is pulls content from a different file as it builds the page -- server side. CSS is browser-dependant and therefore client side. Things that are server side happen first, and once the page is put together with an include, it's exactly the same as if you'd built it from scratch with the included information in the page -- your web browser doesn't know any different. So, it would have to pull from the same CSS file. You can have multiple CSS files, but it will affect the entire page. The only way to have one section of a page use a different CSS is to have it be an entirely different file... for example, by using frames or iframes. But now I'm really curious -- what are you trying to accomplish? :) Hopefully we can come up with a solution for you. :) Donna
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
|  |
 |

Sola
User
Sep 9, 2003, 5:42 AM
Post #5 of 5
(3019 views)
Shortcut
|
|
Re: [Donna] Calling a different css file
[In reply to]
|
Can't Post
|
|
Appreciate your time, Donna. What am I trying to achieve? Trying to take the lazy way out really. I have a slittle space with a couple of scripts on it, each using a different css file (I shouldn't I know!). It works fine now. But when I add the menu as an include, it looks funky simply because there are two css files behind the scene. I will use the class option and include that in each of the css files. That should bring uniformity into it. As I said, I was looking for a way to do the least work, stupid though it sounds. Again, I thank you for helping me sort things out.
|
|
|  |
|