2012-12-14, 05:43:27
You typically never put styles inline aside form one offs.
Plus styles are a pain in the ass in most editors, they like to reformat stuff how they please.
It takes 5 seconds to add a class, in fact it should be second nature to add ids and classes to all elements you write , then you just style it later on all at once.
Or build up your own collection of styles you can use if you use them alot but do not want to really style your site.
.margin-none
.alert
.well
for example grid systems you can do quick stuff like.
.span4
learn specificity and you can do alot of stuff easier and smarter.
need to target a specific page and change a few things then override the defaults using specificity.
Plus styles are a pain in the ass in most editors, they like to reformat stuff how they please.
It takes 5 seconds to add a class, in fact it should be second nature to add ids and classes to all elements you write , then you just style it later on all at once.
Or build up your own collection of styles you can use if you use them alot but do not want to really style your site.
.margin-none
.alert
.well
for example grid systems you can do quick stuff like.
.span4
learn specificity and you can do alot of stuff easier and smarter.
need to target a specific page and change a few things then override the defaults using specificity.
Code:
h2 { font-size:20px }
#pagename h2 {font-size:30px } /* this works because we put the page slug as id in the body tag */
Or alternative heading colors.
h2 {color:blue }
h2.alt1 { color:red } /* h2 with a class of alt1 */
use multiple classes
<h2 class="title bold italic">heading 2</h2>