Jump to content

bootstrap css overrides defined styles


Recommended Posts

(sorry if I choose wrong place to post this. I got confused whether to post it on javascript or css)

 

I am trying to learn bootstrap. but simply after including bootstrap.css, it overrides most of the styles I defined on the page. like buttons, tables, etc. can anyone guide me how to handle this?

Link to post
Share on other sites

Like it was mentioned, your stylesheet should go after bootstrap's stylesheet.

 

After that, check the DOM tab in the developer tools of you browser to see which selectors are being used to style an element. To override an existing selector your selector needs to be more specific. How do you make a selector more specific? Here are a few ways:

  1. Add an ID to the selector. IDs have the highest precedence.
  2. Have more components than the selector you're trying to override. For example: span.class is more specific than .class and ul.menu li a is more specific than .menu a

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...