0

I have multiple css files in html file. It cause conflict for some of the styles.

I want to know execution sequence to avoid conflict or suggest me some other method. Below are the code.

    <link rel="stylesheet" href="libs/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="libs/ionicons/css/ionicons.min.css">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

    <link rel="stylesheet" href="css/owl.carousel.css">
    <link rel="stylesheet" href="css/owl.theme.css">

    <link rel="stylesheet" href="css/nivo-lightbox/nivo-lightbox.css">
    <link rel="stylesheet" href="css/nivo-lightbox/nivo-lightbox-theme.css">

    <link rel="stylesheet" href="css/animate.css">
    <link rel="stylesheet" href="css/main.css"> 
    <link rel="stylesheet" href="css/cropper.min.css">  
    <link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/fileinput.cs">
3
  • We cannot know this without seeing the insides of each. Which would be a rather long process. In short, if you know you have conflicts, you will have to resolve them. If order is important, than tag the most important ones as "important!" Commented Feb 10, 2016 at 19:30
  • Thanks for your comment. Commented Feb 10, 2016 at 19:33
  • As @durbnpoisn says, please provide more info about your question, and try to give screenshots of your data. Please read this How to ask Commented Feb 10, 2016 at 21:24

1 Answer 1

3

The CSS files will be parsed from top to bottom. For example, any conflicting styles in main.css would be overridden by style.css.

I would suggest using a CSS preprocessor like Sass and a task runner like Gulp to bundle your stylesheets together, reducing the number of requests the browser has to make. That would also make it easier to namespace any styles to avoid conflicts.

For example:

#namespace {
  // original code goes here, which will all be prefixed with #namespace
}

FYI, there’s a typo in your code above—css/fileinput.cs is missing an s.

Sign up to request clarification or add additional context in comments.

2 Comments

yeah i know the typo actually during copy 's' was missed out. Anyways thanks for answer. voted up
figured the typo was only in SO and not in your actual source code, but i know i do that sort of thing all the time so wanted to mention it :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.