Upload
carmella-barnett
View
217
Download
0
Embed Size (px)
Citation preview
CSS
New Resources Posted
Look especially at › File Tips and Shortcuts› Student video
Special symbols in HTML < and > are special symbols with special
meaningsHow would you display A < B ?Suggestions?
< for < and > for >& is an escape symbol, handled specially.Always ends with ;
Means that you need a special way to display
“&” too: &
Good list at http://www.utexas.edu/learn/html/spchar.html
Web Instructions: Three Legs
HTML
Content
CSS
Presentation
JavaScript
Behavior
CSS...CSS is for giving style to your contentHTML: contentCSS: styleCSS Zen Garden
What can you change?
Font: size, color, style› More on color next week› For now, by name
Background Border
› Must have size color and style Position: margins, centering Size
Syntax (how it looks)
Selector specifies the HTML element to styleDeclaration:
always contains a property & valueends with a semicolon
Property: style element you want to change Value: what you are changing the property to
Formatting your CSS
Formatting Practices:some flexibility, but you must be consistent.always comment unclear code!
/* someCommentHere */curly bracestab alignment
Bad practices:declarations on the same line as braces or selectormultiple declarations on the same lineleaving off the last semi-colon
Font Families
Preferable to use: universality Multiple fonts: use first available
Defining size
pt refers to printer’s font measurement
px refers to pixels
em is a relative measure› 1 em = base size (defined in body or
default)› Great for changing all at once
Page Structure
General Page Structure<!DOCTYPE html>
<html><head> <! ---defining character necessary for validation --- > <meta charset="UTF-8"> <! --- what shows up on the tab --- >
<title>Put your title here</title></head><body>
<! --- the “good stuff” i--- > What will appear on the page
</body>
</html>
The Body
Every page needs› Header (DIFFERENT THAN head)› Content› Footer
Minimal content› Header: title› Footer: who wrote it and when
Dividing Up the BodyBasic model:
<header>…</header>Use for main title
<main> … </main> Use for the main content
<footer> … </footer>Use for accreditations and citations
Each section can be formatted independently (soon)
Adding CSS to your HTML
The best (only way for this class!) way to insert CSS to your HTML is by using an External Style Sheet
Define all your styles in one placeEasily change the look of your siteUse the following <link> tag within the <head> tag
Save your external style sheet as a .css file.
<link href=“mystyle.css” rel=stylesheet type=“text/css”>
Folder Structure
One folder per assignment
Contains all needed pages› HTML› CSS› (more to follow)
Main (first) page called index.html Can view the page with the folder
name unc.edu/~pozefsky/foldername