original lab idea and code by Victoria Kirst; revised by Brian Le and Marty Stepp
The purpose of this lab is to practice writing Cascading Style Sheets to control the appearance and layout of a web page. You very likely won't finish all of the exercises. Just finish as much as you can within the allotted time. You do not need to work on this lab any more after you leave your lab session, though you may if you like.
Edit Options...button, then on the window that appears, click
Allowthen
Close. Then try to
Install Firebugagain. (You may need to refresh the page.)
You are given a file named journal.html
(right-click and select Save Link As...
) that represents a page from Victoria's journal. You are to write a stylesheet called journal_layout.css
that will transform the layout in different ways throughout the following exercises.
To help you out, you are also given a file named journal_basic.css
that defines some basic styles for this page, and it is already linked for you in the file already.
You do not have to edit this provided stylesheet or the link; just edit the journal_layout.css
that you're writing.
The first task is to organize journal.html
by adding id
s, class
es, span
s and div
s as seen in lecture. Then, add "boxes" around these sections of the website by adding to your journal_layout.css
stylesheet.
Hint: Remember the way to define a border in CSS:
border: thickness color style;
For example, the following gives a yellow, dashed, 1px-thick border:
border: 1px yellow dashed;
You are going to match the output below (between, but not including, the thick black lines).
5px
thick and solid
.
red
.h2
s on this page. id
and class
attributes you need to set in the XHTML code, consider using CSS context selectors as appropriate.
The only major changes you should need to make to the XHTML code are adding id
s, class
es, div
s, and span
s. You may also change the text of the journal if you like, such as changing it to your name or rewording the journal entries. But please don't spend a large amount of time doing this, so you can move on to the later exercises.
You are now going to add padding, margins, and backgrounds to some of the parts you defined in Exercise 1. You should only have to change your journal_layout.css
file, if you completed Exercise 1 correctly.
white
.#E8FBFB
.5px
(on all sides) and margin of 10px
only on the top of the box (the margins for the remaining sides should be left at 0px).
10%
and a background image using the following image: http://www.cs.washington.edu/education/courses/190m/09sp/labs/2-journal/images/background.gif
You are going to match the output below (between, but not including, the thick black lines).
Now you're going to practice float
, clear
, and alignment on the web page. Part of this exercise is understanding the difference between aligning and floating an element. You may have to edit your journal.html
code as well as your journal_layout.css
stylesheet to get the floats working properly.
bleedinto the other content below it.
You are going to match the output below (between, but not including, the thick black lines).
Finally, we add some finishing touches to make the page look its best.
#C2E9E9
for its color.#A8F0F0
and get rid of its border altogether.So fresh and so cleanto 14pt and get rid of its border.
You are going to match the output below (between, but not including, the thick black lines).
Follow the directions at our Uploading Files page to upload your page onto our Webster server. Verify that you did this successfully by viewing your page in the web browser. (Ask a TA if you have any problems logging in to Webster or uploading your files!)
If you manage to complete the first four exercises before lab time is up, work on adding a second column to the layout. You should copy and paste the following code into your journal.html
:
<h1>Friends</h1>
<ul>
<li><a href="http://www.cs.washington.edu/education/courses/cse190m/CurrentQtr/staff.shtml">190m Buddies</a></li>
<li><a href="http://www.willsmith.net/">Big Will</a></li>
<li><a href="http://youtube.com/watch?v=mZHoHaAYHq8" title="Conan the Librarian">Conan the Librarian</a></li>
</ul>
Use the appropriate layout-related tags/attributes and CSS to make this list into a second, left-aligned column as shown below. The colors, borders, etc. of the list are not important; the focus is on the layout.
The layout with a second column must still be a liquid
layout -- that is, all parts of it should adjust in size accordingly when the browser size changes. HINT: When multiple elements float in the same direction, they arrange themselves into columns. Also see textbook Chapter 4's section on "The clear Property" for more information.
You are going to match the output below (between, but not including, the thick black lines).
Write your page so that if you hover over any element (i.e. any header, paragraph, image, etc), the element is highlighted in yellow.
This must be a one-selector, one-property addition to your stylesheet -- no commas allowed! (Note: This is tricky.)