CSSE 290 Web Programming

Lecture 3: HTML Misc, CSS Intro

Reading: 3.1 - 3.3

Attribution:Except where otherwise noted, the contents of this document are Copyright 2012 Marty Stepp, Jessica Miller, and Victoria Kirst. All rights reserved. Any redistribution, reproduction, transmission, or storage of part or all of the contents in any form is prohibited without the author's expressed written permission.

Otherwise noted: Claude Anderson was given permission to modify the slides for CSSE 290 at Rose-Hulman by author Jessica Miller. The authors' original slides, based on Web Programming Step by Step, can be seen at http://webstepbook.com.
Some of the examples in some days' slides are from David Fisher at Rose-Hulman, who was kind enough to allow me to use them. My intention is to mark these examples with [DSF].

Valid HTML Valid CSS!

W3C HTML Validator

<p>
	<a href="http://validator.w3.org/check/referer">
		<img src="http://webster.cs.washington.edu/w3c-html.png"
		alt="Validate" />
	</a>
</p>

HANDOUT ONLY
  • Ask for Questions
  • Go through the codeAcademy submission process

Make a Web Page Public

SecureFX sample use

Submit an Assignment

2.2: More HTML Elements

HTML Tables: <table>, <tr>, <td>

A 2D table of rows and columns of data (block element)

<table>
	<tr><td>1,1</td><td>1,2 okay</td></tr>
	<tr><td>2,1 real wide</td><td>2,2</td></tr>
</table>
1,11,2 okay
2,1 real wide2,2

Table headers, captions: <th>, <caption>

<table>
	<caption>My important data</caption>
	<tr><th>Column 1</th><th>Column 2</th></tr>
	<tr><td>1,1</td><td>1,2 okay</td></tr>
	<tr><td>2,1 real wide</td><td>2,2</td></tr>
</table>
My important data
Column 1Column 2
1,11,2 okay
2,1 real wide2,2

Exercises 1 and 1.5

  1. Go to the Schedule page
  2. Follow the link to get today's exercises
  3. Unzip the archive, and go to the Exercises folder
  4. Look at the GoalForExercise1.png screen shot
  5. Read the Instructions.txt file, and do Exercise 1 (lists)
  6. If you have time left, work on Exercise 1.5 (tables), which is Exercise 7 from Dave Fisher's exercises from Session 2
  7. Talk with your partner, and get help from the TAs or instructor as needed

One Property, Multiple Selectors. Multiple Rules That Affect Same Tag.

p, h1, h2 {
	color: red;
}
h2 {
	background-color: yellow;
}

This paragraph uses the above style rules.

This h2 also uses the above style rules.

CSS Context Selectors

selector1 selector2 {
	properties
}
selector1 > selector2 {
	properties
}

Context Selector Example

<p>Shop at <strong>Hardwick's Hardware</strong>...</p>
<ul>
	<li>The <strong>best</strong> prices in town!</li>
	<li>Act while supplies last!</li>
</ul>

li strong { text-decoration: underline; }

CSS Comments: /* ... */

/* This is a comment.
  It can span many lines in the CSS file. */
p {
	color: red;
	background-color: aqua;
}

W3C CSS Validator

<p>
	<a href="http://jigsaw.w3.org/css-validator/check/referer">
		<img src="http://jigsaw.w3.org/css-validator/images/vcss"
			alt="Valid CSS!" /></a>
</p>
Valid CSS!

Exercise 2

  1. Look at the GoalForExercise2.png screen shot
  2. Read the Instructions.txt file, and do Exercise 2
  3. Talk with your partner, and get help from the TAs or instructor as needed
  4. Solution is provided; refer to it if all other help sources fail you
  5. When you finish: if you did not finish Exercise 1.5, continue working on it
  6. 20 minutes before the end of class time, we'll discuss more CSS slectors and properties