Days I spent in a web development immersive course: 90
Days the intructors spent on CSS: 1
1.11% of class time
...and some of that was spent talking about Bootstrap
“What we may not have realized is that once the browsers don’t suck, being an HTML and CSS 'guru' isn’t really a very marketable skillset.”
- Jeff Croft
“There is a big difference between someone who knows how to write good CSS and HTML and someone who doesn't.”
It's hard to follow best practices when you're not writing CSS in a vaccuum - but that's when you need them the most.
discovery-item-container {
color: #b5b3ae;
border-top: 1px solid #d2cbb7;
margin-right: 0;
height: 63px;
display: inline-block;
width: 100%;
img {
display: none;
}
.discovery-item {
margin-left: 3%;
padding: 0;
margin-top: 3px;
height: 100%;
width: 96%;
display: table;
}
.discovery-figure {
display: table-cell;
vertical-align: middle;
margin-left: 5%;
padding: 0 5% 0;
line-height: 16px;
width: 15.5%;
.figure-f {
vertical-align: text-top;
}
.figure-ig {
text-decoration: underline;
font-size: 10px;
line-height: 12px;
vertical-align: text-top;
}
}
}
Writing good CSS makes it easier to keep writing good CSS.
A lot of CSS standards and best practices are widely agreed upon...but not all of them
!important
“I have a blanket-ban on IDs in CSS. There is literally no point in them, and they only ever cause harm. Everything that needs styling is done so without using IDs. ”- Harry Robert http://csswizardry.com/2012/04/my-html-css-coding-style/
.class.some-other-class.one-more-class.yet-another-class {...}
Takeaway: Only use IDs for CSS if it really makes sense - and it probably wouldn't hurt to not use them at all.
!important
!important
= bad.!important
= bad.!importants
is usually a signal that you've lost control and understanding of what's going on with your CSS..button {
background: red !important;
color: white !important;
padding: 3px !important;
border-radius: 5px !important;
border: 1px solid black !important;
/* For good measure */
text-decoration: none !important;
}
http://css-tricks.com/when-using-important-is-the-right-choice/
Takeaway: !important is okay to use, as long as you're using it intentionally, and not out of exasperation.
Start with the most modern browsers and work your way down to IE8
OR
Start with IE8 and work your way upward
html class="js canvas canvastext no-geolocation rgba hsla multiplebgs borderimage
borderradius boxshadow opacity cssanimations csscolumns cssgradients cssreflections
csstransforms csstransforms3d csstransitions video audio localstorage sessionstorage
webworkers applicationcache fontface"
http://domain7.com/blog/progressive-enhancement-graceful-degradation-modernizr
.button {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
.no-borderradius .button {
background-image: url('rounded_corners.png');
}
http://domain7.com/blog/progressive-enhancement-graceful-degradation-modernizr
.button {
background-image: url('rounded_corners.png');
}
.borderradius .button {
background-image: none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
http://domain7.com/blog/progressive-enhancement-graceful-degradation-modernizr