Ashley Williams, NYCDA
Thursday, 7 Mar 2013
e.g. <div></div>
e.g. <div>
<a href="page2.html">Link</a>
</div>
e.g. <div class="article" id="first">
<a class="button submit">Submit the Form </a>
</div>
<!-- INSTRUCTIONS
1. refactor the <!DOCTYPE> and <html> tag to use the new HTML5 syntax
2. replace the <divs> with the appropriate HTML5 elements
3. remember to update the header levels when creating new header elements
4. add article tags around appropriate elements
-->
e.g. <div style="background-color: red; color:blue;"></div>
e.g. <head>
<style>
div { background-color: red; color: blue; }
</style>
</head>
e.g. <head>
<title> My Page </title>
<link rel="stylesheet" href="styles.css"/>
</head>
<h1 class="intro" id="header">NYCDA Web Dev</h1>
h1 {
color: #ffffff;
font-style: bold;
}<h1 class="intro" id="header">NYCDA Web Dev</h1>
.intro {
color: #ffffff;
font-style: bold;
}<h1 class="intro" id="header">NYCDA Web Dev</h1>
#header {
color: #ffffff;
font-style: bold;
}<h1 class="intro" id="header">NYCDA Web Dev</h1>
h1#header{
color: #ffffff;
font-style: bold;
}<div class="practice" id="first">This is Only a Test</div>
div {
background-color: #666666;
color: black;
font-style: italic;
}
div {
color: green;
font-family: georgia, sans-serif;
}
float: left / right / none
<!-- INSTRUCTIONS 1. remove all inline and <head> styles and put them in the external stylesheet so that you no longer need the !important for background-color 2. center the slogan and make it italic using an ID selector 3. float the aside to the right and add 10px of margin to its left and bottom sides 4. then make the article width the same width as the aside and float it left -->
<article>
<aside>
<img src="giraffe.png" height="100px"/>
</aside>
</article>
.group:before,
.group:after {
content: "";
display: table;
}
.group:after {
clear: both;
}
.group {
zoom: 1; /* IE6&6 */
}
<div id="parent>
<div class="child" id="1"></div>
<div class="child" id="2"></div>
<a class="child" id="3">Submit</a>
</div>
#parent {
font-style: italic;
}
#parent .child {
font-style: normal;
}
div a {
font-style: normal;
}
header { -moz-border-radius: 2px; }
.row { text-shadow: 4px 4px 1px #fff; }
#copyright { text-style: italic; }
<a style="color: red">Delete</a>
aside { padding: 0 0 20px 20px; !important}
Write compound selectors to have the following priorities:
<!-- INSTRUCTIONS 1. refactor this code to use clearfix to clear floats 2. use a nested selector to make paragraphs in asides italic 3. for anchor tags inside aside paragraphs, override the inherited font-style and make it normal 4. refactor the css for .active and .copyright so that !important can be removed -->
overflow: visible / auto / hidden / scroll
position: static / relative / absolute / fixed
top: // left: // bottom: // right:
<!-- INSTRUCTIONS 1. make the figure in the footer have a total box width and height of 120px (consider the padding, margin, and border values that already exist) 2. hide overflow on the x-axis and add a scroll bar on the y-axis (if necessary) **hint: you can use overflow-x and overflow-y to target different axies 3. anchors with thte button class are floated to the right. to center them vertically use relative positioning to move the button down 3px 4. the newsletter paragraph is sticking to the bottom of the window instead of the bottom of the footer. add the necessary positioning to scope it correctly 5. use absolute positioning to place the figure in the upper right hand corner of the footer -->
<section class="events">
<article id="1"></article>
<article id="2"></article>
<article id="3"></article>
</section>
Refactor these selectors:
#1 { font-family: Helvetica, sans-serif; }
#2 { font-family: Helvetica, sans-serif; }
#3 { font-family: Helvetica, sans-serif; }
p { line-height: 1em; }
footer#primary { line-height: 1em }
.product {
line-height: 1em
padding: 10px;
}
<a href="learn_more.html" class="learn_more">Learn More</a>
<button href="contact.html" class="contact">Contact Us</button>
.learn_more { border: 1px solid #000; background-color: red;
color: white; text-transform: uppercase;
}
.contact { border: 1px solid #000; background-color: blue;
color: white; text-transform: uppercase;
}
article {
padding-top: 20px;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 20px;
}
article {
padding: 20px 10px 20px 10px;
}
article {
padding: 20px 10px;
}
font: 16px/18px bold italic sans-serif;
/* size/line-height weight style family */
background: #000 url(image.png) no-repeat center top;
/* color image repeat x-pos y-pos */
margin or padding: 0 10px 0 10px;
/* top right bottom left / t r&l b / t&b r&l */
border: 3px solid #ccc;
/* width style color */
display: none / block / inline / inline-block
Block elements:
<div>, <p>, <ul>, <ol>, <li>, <h1>...<h6>
<span>, <a>, <em>, <img>, <strong>
<header>
<h1>Sven's Snowshow Superstore</h1>
<p>Our snowshoes are so stylish!</p>
<a class="sale" href="/sale">View our sales</a>
</header>
.sale {
float: left;
width: 100%;
padding: 0 10px;
margin: 5px 0;
text-align: center;
}
<aside>
<img src="pic.png"/>
</aside>
aside img {
width: 200px;
margin: 0 auto;
}
<footer>
<span class="copyright">(c) Sven's Snowshoe Superstore </span>
</footer>
footer {
text-align: center;
}
<body>
<div class="newsletter">
<header>
<h1>Sign up for our newsletter!</h1>
</header>
</div>
</body>
<!-- INSTRUCTIONS 1. refactor the article declarations to make them apply to a single parent container 2. combine selectors that have the same properties using a comma delimited list, then override that declaration using individual definitions 3. refactor the paragraph properties to use shorthand syntax 4. make the nav list items display horizontally using display: inline. give them right and left margins of 5px (don't forget to use shorthand!) 5. center the nav items, use shorthand syntax where appropriate -->