CSS (LOOK’N GOOD)
WHAT IS IT?
h2 { font-family: helvetica; color: red; font-size: 12px; }
SELECTOR VALUE h2 { font-family: helvetica; color: red; font-size: 12px; } PROPERTY
THIS IS A HEADLINE THIS IS A HEADLINE
WHAT ELSE CAN IT DO?
WHAT ELSE CAN IT DO? - TYPOGRAPHY - COLOR - IMAGES - STRUCTURE/LAYOUT - COMPOSITION - ANIMATIONS - BASICALLY, ANYTHING VISUAL
CSSZENGARDEN
TYPE font-family (Helvetica, Times, etc.) font-size color text-align (left, center, right) text-decoration (underline, none) text-style (italic, normal) font-weight (bold, normal)
LAYOUT margin padding border width height
LAYOUT WIDTH Pork belly etsy beard fixie. Chillwave banh mi HEIGHT american apparel, trust fund bushwick skateboard viral. PADDING Wolf messenger bag twee, raw denim terry richardson MARGIN forage selvage single-origin coffee. Food truck raw denim fixie pinterest chillwave mumblecore. American apparel photo booth truffaut pour-over high life pop-up. BORDER
LET’S TRY IT
MAKE ‘style.css’
STUFF THIS IN YOUR <HEAD> <link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
h1 { font-family: helvetica; color: red; font-size: 12px; }
UNITS (SIZE) 12px 15pt 1.2em 80%
UNITS (COLOR) blue #fa3c14 rgb(125,74,214) rgba(159,15,88,.7)
BACKGROUNDS background: red; background: url(../img/imagename.png);
! S U N O B Subtle Patterns
ID’S AND CLASSES (NAMIN’ NAMES)
ID HTML: <h2 id=“subtitle”>TITLE</h2> CSS: #subtitle { ... }
CLASS HTML: <h2 class=“subtitle”>TITLE</h2> CSS: .subtitle { ... }
WHICH ELEMENTS CAN CLASSES AND IDS BE APPLIED TO?
ALL OF THEM
BUT WHAT ABOUT THE <HEADER> TAG?
WHAT DID I JUST SAY?!
ALL OF THEM
ID’S LET’S KEEP IT CLASSY CLASSES
SELECTORS p { ... } SELECTS ALL <p> TAGS h1, h2, h3 { ... } SELECTS ALL <h1>, <h2>, and <h3> TAGS div p { ... } SELECTS ALL <p> TAGS INSIDE OF A <div> tag * { ...} SELECTS ALL ELEMENTS div * { ... } SELECTS ALL ELEMENTS INSIDE ANY DIV #idname { ... } SELCTS ANY ELEMENT WITH “idname” AS AN ID .class { ... } SELCTS ANY ELEMENT WITH “class” AS A CLASS
INHERITANCE <section> <h2>Section Title</h2> <p>Important Information</p> <p>Important Information</p> </section>
ORDER OF PRECEDENCE .blue { color: blue; } div { color: green; } <div class=“blue”>What AM I?!?!</div>
ORDER OF PRECEDENCE 1. NO. OF ID’S 2. NO. OF CLASSES 3. NO. OF ELEMENTS 4. ORDER OF APPEARANCE
ORDER OF PRECEDENCE 1. NO. OF ID’S #container #sidebar ul { ... } WILL BEAT #container ul { ... }
ORDER OF PRECEDENCE 2. NO. OF CLASSES .container .sidebar ul { ... } WILL BEAT .container ul { ... }
ORDER OF PRECEDENCE 3. NO. OF ELEMENTS div p a { ... } WILL BEAT a { ... }
ORDER OF PRECEDENCE 0 0 0 NUMBER OF IDS CLASSES ELEMENTS/PSEUDEO ELEMENTS
ORDER OF PRECEDENCE 0 0 0 NUMBER OF IDS CLASSES ELEMENTS/PSEUDEO ELEMENTS 0 2 1 .container .sidebar ul { ... } 1 0 1 #container ul { ... }
ORDER OF PRECEDENCE 4. ORDER OF RULES h3 { ... } (LINE 62) WILL BEAT h3 { ... } (LINE 17)
! S U N O B FIREBUG IS SOOOO HAWT.
WHATEVER, THOM. IT STILL LOOKS LIKE A MARGINALLY PRETTIER LIST OF CONTENT.
THAT’S TRUE
THAT’S TRUE ...FOR NOW.
Recommend
More recommend