erica mitchell
Founder, blackGirlsCode(2), Javascript Enthusiast
Please download workshop files here:
https://github.com/blackgirlscode
# Base
– normalize.css
– layout.css
– typography.css
# Components
– alerts.css
– buttons.css
– forms.css
– list.css
– nav.css
– tables.css
# Modules
– aside.css
– footer.css
– header.css
The goal here is to start thinking of websites as systems rather than individual pages.A methodology with two principles to help build scalable websites with a strong architecture & a reasonable amount of code:
Seperate structure from skin
seperate content from containter
METHODOLOGY BREAKING UP STYLES INTO FIVE CORE CATEGORIES:
/* Bad */ button strong span {...} button strong span .callout {...} /* Good */ button span {...} button .callout {...}
/* Bad */ #container header nav {...} /* Good */ .primary-nav {...}
/* Bad */ .news { background: #eee; border-radius: 5px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25); } .social { background: #eee; border-radius: 5px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25); } /* Good */ .news, .social { background: #eee; border-radius: 5px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25); } /* Even Better */ .modal { background: #eee; border-radius: 5px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25); }
The DOM, or Document Object Model, is an API for HTML and XML documents which provides their structural representation. In our case, we are speaking specifically to HTML documents, thus the DOM represents all of the different elements and their relationship to each other.
.box-set { overflow: auto; }
h1 {...} .tagline {...} #intro {...}
article h2 {...}
article > p {...}
Flexible layouts do not advocate the use of fixed measurement units, such as pixels or inches.
The formula is based around taking the target width of an element and dividing it by the width of it’s parent element. The result is the relative width of the target element.
target ÷ context = result
.container { width: 538px; } section, aside { margin: 10px; } section { float: left; width: 340px; } aside { float: right; width: 158px; }
/* @media Rule */ @media all and (max-width: 1024px) {...} /* @import Rule */ @import url(styles.css) all and (max-width: 1024px) {...}
/* Default styles first then media queries */ @media screen and (min-width: 400px) {...} @media screen and (min-width: 600px) {...} @media screen and (min-width: 1000px) {...} @media screen and (min-width: 1400px) {...}
<meta name="viewport" content="user-scalable=yes">
By erica mitchell
Founder, blackGirlsCode(2), Javascript Enthusiast