100 likes | 182 Views
GBK Programming 1 2009-10. Jordan Johnson. Today’s plan. Greetings Review markup/HTML basics A diversion: Structure vs. presentation (or appearance) Stylesheets and CSS Homework Clean-up. Web pages. HTML files define the structure of Web documents:. html. body. head. title .
E N D
GBK Programming 12009-10 Jordan Johnson
Today’s plan • Greetings • Review markup/HTML basics • A diversion: • Structure vs. presentation (or appearance) • Stylesheets and CSS • Homework • Clean-up
Web pages HTML files define the structure of Web documents: html body head title Films h1 Movies I like big dumb action movies like these: p ul li Transformers Terminator II li Die Hard li <html> <head> <title>Films</title> </head> <body> <h1>Movies</h1> <p>I like big dumb action movieslike these:</p> <ul> <li>Transformers</li> <li>Terminator II</li> <li>Die Hard</li> </ul> </body> </html>
Structure vs. Appearance • Problem: • We know the structure, but we don’t know how to make the page look the way we want. • Bigger problems: • If we use tags for changing fonts and colors and so on, it’s harder to see the connection between the source code and the page’s meaning. • HTML coding and visual design aren’t always done by the same people. Their work needs to be somewhat independent of each other.
Solution: Stylesheets <html> <head> <title>Films</title> <link rel=“stylesheet” type=“text/css” href=“styles.css” /> </head> <body> <h1>Movies</h1> <p>I like big dumb action movieslike these:</p> <ul> <li>Transformers</li> <li>Terminator II</li> <li>Die Hard</li> </ul> </body> </html> • Just one change to the HTML file: link to a stylesheet. • “styles.css” is the name of the stylesheet file. • The stylesheet defines the page’s appearance.
Contents of styles.css body { margin-top: 0.5in; margin-left: 0.5in; margin-right: 0.5in; } h1 { color: blue; } “Properties” Notice the indentation. • Set the margins: • This block affectsthe body’s contents. • Header color: • This affects onlythe h1 (header)tag’s contents. • Search online for more CSS properties.
Next Task • Construct a simple Web site • 2 pages: • First: Academic – list your class schedule • Second: Personal – link to some sites you use frequently, and describe them. • Use ul and li tags to make your lists • Break lines and use whitespace to make your code easy to read. • Indent lists. • Next, make a stylesheet and add some styles.
Example Indentation Blank lines to highlightthe document’s structure <html> <head><title>Academics</title></head> <body> <h1>Class Schedule – Jordan Johnson</h1> <p>This is my class schedule; I also have a <a href=“personal.html”>personal</a> page.</p> <ul> <li>Period 1: Geometry</li> <li>Period 2: Geometry</li> <li>Period 3: Geometry</li> <li>Period 6: Programming 1</li> </ul> </body> </html>
Homework • Journal #1 • …is due tomorrow (Friday) afternoon. • HW #1 • Make two pages (“Academic” and “Personal”), with: • A description of each web site you linked to • A small (i.e., no wider/taller than 300px) picture somewhere, with an alt attribute • More information about the classes: teacher names and brief summaries (1-2 sentences tops) • A stylesheet. • Maintain good formatting and indentation in both HTML & CSS. • See www.fellowhuman.com/gbkfor details.
Clean-up • Before you leave, please . . . • Log out. • Push in your chair. • Make sure you’ve got everything. • Make sure all trash ends up in the trash can.