Skip to content Skip to sidebar Skip to footer

Bootstrap CSS Editing

I just recently installed bootstrap 3.0 onto my site and have been playing around with. I've got a couple questions regarding it; I want to change certain specifications for the ju

Solution 1:

It's called CSS Specificity.

http://stackoverflow.com/questions/12780511/how-does-a-css-rule-override-another-css-rule

"Because of CSS Specificity. A selector's weighting is evaluated based on the components that make it up, with id's given a weighting of 100, classes with a weighting of 10, and element selectors with weighting of 1."

It means, the more specific your target element is, the higher weight it gets.

so if you want to specify some properties for .jumbotron class,

in order to override it, you need to make the selector more specific,

for example,

#your_id .jumbotron

This way, when your browser interpretes your CSS styles,

if chooses your style rather than Bootstrap's default style.


Solution 2:

"I have a file called 'mycss.css' "


<link href="css/my.css" rel="stylesheet" media="screen">

These don't match. That could be the problem.

My answer is probably the real problem, BUT -

@SeWonJang's point it still valid whether it is an ID or a class - and could very well be the issue. If I make: .main-content ul {list-style: none} and then somewhere in .main-content give a class of my-list to a ul - I can't just say .my-list {list-style: disc} --- because I've already been too specific(or overarching) - I've already said: "Apply these rules to ANY ul inside of .main-content." This wins over .my-list {list-style: disc}. Now I have to say .main-content .my-list {list-style:disc} I have really only found this to be a real issue with type. Since almost everything ever is a list of crap - but then in the article text I want some list-style --- That is the best example for me.


Post a Comment for "Bootstrap CSS Editing"