How to merge css files

Discussion in 'HTML & Website Design' started by bubaipal, May 22, 2008.

  1. #1
    Hello
    I have 3 css files with different things. I made them from online generators. How do I merge them into 1?

    Thanks
     
    bubaipal, May 22, 2008 IP
  2. 06WebDesign

    06WebDesign Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Why would you want to merge them? simply link your html file to all 3 separate css files.

    Always ensure that you don't have any classes that repeat themselves in those 3 css files and you should be right
     
    06WebDesign, May 22, 2008 IP
  3. steelfrog

    steelfrog Peon

    Messages:
    537
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Long answer short: simply copy & paste one at the end of another. As long as you don't have conflicting definitions (e.g., h3 being styled twice) it should be fine.

    Alternatively, you could call all three files via the @import rule in the main stylesheet, but you should avoid that if possible.

    The best, albeit most complex and time-consuming solution would be to dedicate one stylesheet as the master and then manually add the other styles in one by one and verify that they will no conflict with other styles. It may take you a bit to do depending on the length of the stylesheets, but it will save you from having to dig into three CSS files later on.
     
    steelfrog, May 22, 2008 IP
  4. ferman

    ferman Well-Known Member

    Messages:
    968
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    140
    #4
    you can copy paste them in one file if already all 3 are working fine...means you already don't have conflicting definitions
     
    ferman, May 22, 2008 IP
  5. dylanj

    dylanj Peon

    Messages:
    173
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #5
    Put it this way: If there are any conflicting definitions, they'll be merged. Just remember that whatever is at the bottom of the document will over-ride anything else.
     
    dylanj, May 23, 2008 IP