Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Two CSS

  1. #1
    New Coder
    Join Date
    Nov 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Two CSS

    Hey again, I'm just curious how I'd link to two css sheets in one html file.
    Like this:

    <link rel="stylesheet" type="text/css" href="style.css" />

    That's to get my basic design and all the features. But I want to link to the css of the forum I have as well, but I don't know how I'd link to both. They're both in different directories as well.

    Thanks guys. =]

  • #2
    Senior Coder koyama's Avatar
    Join Date
    Dec 2006
    Location
    Copenhagen, Denmark
    Posts
    1,246
    Thanks
    1
    Thanked 5 Times in 5 Posts
    I think this counts as a simple question
    Well anyway its easy, just insert one more link tag
    <link rel="stylesheet" type="text/css" href="style.css" />
    <link rel="stylesheet" type="text/css" href="someDir/anotherstyle.css" />
    The sequence matters, though. The above is equivalent to merging the two stylesheets into one .css file in that sequence.

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,640
    Thanks
    0
    Thanked 649 Times in 639 Posts
    As long as you don't give the stylesheets a title browsers will pick up all of the stylesheets listed. If you give them titles then only the last one will be used and yourvisitors would need to use a style switcher (either built into their browser or written in Javascript) to switch between them.

    If you want to use multiple stylesheets and titles at the same time then use an @import line to import the first stylesheet into the top of the second and just include the second one in the HTML.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •