Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS 2 CSS Files to using same selector

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #35629
    mabrams
    Participant

    Hi there!

    I am trying to port a theme however I want to use two separate css files for colors(colors.css) and layout (styles.css). The reason for this is I will be creating many sites with the same theme just different colors and want to simply the work involved. The problem with this is that both files will share the same selector and one will inevitably overwrite the other.

    Ex:

    (styles.css)

    #div {
    width:200px;
    margin:auto;
    }

    (colors.css)

    #div {
    color:#555555;
    background:#444444;
    }

    I would like it to combine both. Is there a way using jquery or some kind of conditional that will allow this?

    Thank you!

    Michael Abrams

    #92654

    They will both work fine as you currently have them. The only time one would override the other is if the same property was declared in both style sheets.

    #92663
    Mottie
    Member

    You could just use a stylesheet switcher.. it’s really very clever in that only the currently selected stylesheet has an enabled <link> tag so you can include all your stylesheets link tags in the header and not have to worry about loading new ones dynamically.

    #92723
    mabrams
    Participant

    @joshuanhibbert, I don’t know what is happening but it seems to be using one or the other and not both even though they do not share the same properties


    @Mottie
    , Im not trying to change the theme back and forth, just use 2 css files that contain the same div id or class, one css controls the color of a certain div, and the other css controls the layout of that same div

    *I am using magento

    #92744
    jamygolden
    Member

    http://jsfiddle.net/K2tN2/

    Try validating your html and css to see if you can find any noticeable problems.

    #92747
    mabrams
    Participant

    @jamy_za, thank you, validating my css worked..had no idea it would even load the file if it has syntax errors. Much appreciated!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.