CSS, Javascript & Box Model: Lee Byron Web Design, Fall 2007 Cmu School of Design
CSS, Javascript & Box Model: Lee Byron Web Design, Fall 2007 Cmu School of Design
Lee Byron
Web Design, Fall 2007
CMU School of Design
Font size
(Arbitrary)
Font color
For all
cells (px)
For all
cells (px)
Total (px)
Total (px)
Horz. Align
Vert. Align
Width (px)
Height (px)
HTML
Make it about the content
<library>
<name>Squirrel Hill Public Library</name>
<location>Forbes Ave. & Murray Ave., Pittsburgh PA</location>
<aisle>
<topic>Science</topic>
<book>
<title>A Brief History of Time</title>
<author>Stephen Hawking</author>
<pages>340</pages>
</book>
</aisle>
<aisle>
<topic>Non-Fiction</topic>
<book>
<title>The Art of War</title>
<author>Sun Tzu</author>
<pages>230</pages>
</book>
</aisle>
</library>
<h1>
<ol>
<ul>
<li>
<dl>
<dt>
<dd>
A general
type
<library>
<name>Squirrel Hill Public Library</name>
<location>Forbes Ave. & Murray Ave., Pittsburgh PA</location>
<aisle>
<topic>Science</topic>
<book>
<title>A Brief History of Time</title>
<author>Stephen Hawking</author>
<pages>340</pages>
</book>
</aisle>
<aisle>
<topic>Non-Fiction</topic>
<book>
<title>The Art of War</title>
<author>Sun Tzu</author>
<pages>230</pages>
</book>
</aisle>
</library>
<div id=library>
<div class=name>Squirrel Hill Public Library</div>
<div class=location>Forbes Ave. & Murray Ave., Pittsburgh</div>
<div class=aisle>
<div class=topic>Science</div>
<div class=book>
<div class=title>A Brief History of Time</div>
<div class=author>Stephen Hawking</div>
<div class=pages>340</div>
</div>
</div>
<div class=aisle>
<div class=topic>Non-Fiction</div>
<div class=book>
<div class=title>The Art of War</div>
<div class=author>Sun Tzu</div>
<div class=pages>230</div>
</div>
</div>
</div>
What is CSS?
website
style.css
or...
<div style=color:#FF6633;>Content</div>
A CSS rule
selector{
attribute: value;
}
selector
attribute
value
Per-tag CSS
<td class=general>A generic table cell</td>
<div class=general>A generic block</div>
General
Per-tag
td{
font-weight: bold;
}
td.general{
font-size: 12px;
}
.general{
color: #FF6633;
}
div.general{
font-size: 14px;
}
Cascading CSS
<div class=general>A generic block</div>
<div id=group>
<div class=general>A generic block</div>
</div>
.general{
font-weight: bold;
}
#group .general{
color: #FF6633;
}
CSS Typography
color:
font-family:
font-weight:
font-style:
font-variant:
font-size:
text-decoration:
text-indent:
text-align:
letter-spacing:
word-spacing:
line-height:
text-transform:
#RRGGBB;
serif, sans-serif, monospace;
bold, normal;
italic, normal;
small-caps, none;
12px, 120%, 1.2em;
underline, line-through, none;
20px, 3em;
left, right, center;
2px, 0.2em;
10px, 1em;
14px, 140%, 1.5em;
capitalize, lowercase, uppercase, none;
font-family
font-family expects a list of fonts, for example...
font-family: Lucida Grande, Helvetica, Arial, sans-serif;
If the first font isnt found, it will try the next, and the
next, and so on. This way you can specify a non web
standard font, as long as you specify backup fonts.
Fonts with spaces must be in quotes, i.e. Lucida Grande
There should always be a generic font at the end of the
list. The actual font used will be different depending on
the users language and operating system.
serif, sans-serif, cursive, fantasy, monospace
Relative
Defines a size based on the
current font size em
line-height: 1.3em;
Percentage
1em
a{
color: #333333;
text-decoration: none;
}
:hover
a:hover{
color: #FF6633;
text-decoration: underline;
}
:visited
a:visited{
color: #666666;
}