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 8 of 8
  1. #1
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Are multiple external css files valid?

    I'm writing a CMS system at the moment and part of what I wanted to do was allow users to attach their own custom external css files to pages if they need to, not to replace the existing css file but to append it.

    Is it valid to attach multiple css files to one page or will it cause problems? Also, how are things like element name conflicts resolved, is priority given to the last declared css element or the first, etc?

    Thanks in advance for any help you can offer.

  • #2
    Regular Coder zro@rtv's Avatar
    Join Date
    Feb 2005
    Location
    on the network
    Posts
    433
    Thanks
    0
    Thanked 1 Time in 1 Post

    multi ok

    multiple style sheets are ok....
    but im not sure how conflict is resolved.
    ._-zro
    zro@redtv
    zro.redtv.org

    "If HTML and the Web made all the online documents look like one huge book, RDF, schema, and inference languages will make all the data in the world look like one huge database"
    -Tim Berners-Lee, Weaving the Web, 1999

  • #3
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmm, well I guess I could always append some text to the beginning of my own elements to make it more unlikely that people will try to add duplicate elements. I also have a feeling that the later defined css would take precedence but I don't know if that's true, it just seems to make more sense.

    Thanks for the info

  • #4
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Several stylesheets are indeed allowed. The resolution is simple: all things from all style rules are applied to everything the selectors match. Properties from rules with higher selector specificity override properties from rules with lesser specificity. If the same property is applied from two rules with the same selector specificity, the last one in source order will override those before.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #5
    Regular Coder
    Join Date
    Dec 2002
    Location
    UK
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Lets say you have a style called .leftcontent
    And someone else has a style called .leftcontent

    The last instance in the style sheet will be applied to that page/site.

    Yes, you can have multiple stylesheets in the same document.

  • #6
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Excellent, so as long as I insert the master stylesheet after any user-created stylesheet mine should take priority. Just what I needed to know, thanks

  • #7
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Sounds like you are trying to do something similar to me.

    If you could explain your application, I might have a solution for your specific issue.

    Bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #8
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,801
    Thanks
    8
    Thanked 131 Times in 129 Posts
    Sounds kinda like what myspace.com has. You can edit into the text fields any CSS you want. You can view thier css page and pick the values you want to change. Since thiers is in the head, anything the user puts into a text feild takes precedence.

    They went a long way building a lot of the layout in tables so that there were a good bit of uneditable properties of the page.


  •  

    Posting Permissions

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