Assignment Module X20g

Formatting with In-Line Styles (1)



Overview

For this exercise, you'll be creating a simple CSS/XHTML format sampler, to show several different ways styles can be used to vary the appearance of Web documents. You'll then be formatting a longer and more complex sample.


Getting Started

to Top

Save your XHTML template file as X20g.htm, and title the page, "Sarah Strong X20g" Change Sarah Strong to your own name wherever you see it, and make sure your name is listed as author, as well.

Sample 1

to Top
  1. Use your mouse to highlight the text in thje colored box below. Copy it, and paste it into the body section of your X20g sample file.
Comment: Format the next line as a Heading 1:
Sarah Strong's HTML Format Sampler
Comment: Format each of the following lines 
Comment: to be what it says it is:
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6


Comment: The next lines are each part of one paragraph,
Comment: with breaks between, to put each on it own line.
Comment: Make each line the size it says it is.
Normal text size
Size 5 pixels
Size 8 pixels
Size 10 pixels
Size 12 pixels
Size 15 pixels
Size 20 pixels
Size 30 pixels


Comment: The next lines form another paragraph, also
Comment: with breaks between, to put each on it own line:
Comment: Make each line the size it says it is.
Normal text size
Size 50 percent
Size 80 percent
Size 100 percent
Size 120 percent
Size 150 percent
Size 200 percent
Size 300 percent
Normal text size


Comment: This section is a paragraph without line breaks.
Comment: Make each color word match its name.
We can create millions of colors on Web pages,
the most popular of which are 
red, 
yellow, 
green,
and 
blue. 
Just as interesting are 
aqua, 
fuchsia, 
gray, 
lime, 
maroon, 
navy, 
olive, 
purple, 
silver, 
and 
teal.


Comment: Each of the following lines is a paragraph,
Comment: and should be aligned as it states.
This line is centered

This line is aligned left
This line is aligned right


This line and the following five are part of a
paragraph which is justified. A justified paragraph
is one in which the left and right ends of each
line go all the way to the left and right margins.
The exception is the last line of the paragraph,
which is not brought up to the right margin.


Comment: Set the font family as shown in each line.
Comment: Make each line a separate paragraph.

This line is Verdana, Helvetica or sans-serif font family.
This line is Courier New, Courier, or monospace font family.
This line is Georgia, Times New Roman, or serif font family.
This line is Papyrus, Comic Sans MS, or fantasy font family.
This line is Lucida Handwriting, Brush Script MT, or cursive font family.
  1. Still using Notepad, read the lines that say, "Comment". These are the instructions on what style to use for each part of the Web page. Format each part as instructed in the Comments, using your book,the toolkit in module X20b, or on-line reference materials,. Just to be sure, save your file after completing each part.
  2. Check the page in a browser. The Comments should still be visible, so you can make sure each part is formatted according to the instructions.
  3. If any part isn't right, check your code against examples in the reference materials, and correct your code.
  4. When each part is correct, put (X)HTML <!-- comment markers --> around the comments. Save your file and check in a browser to make sure the comments have all disappeared in the rendered page.
  5. Validate the file and make any corrections necessary.

When you're done with this part, this is what it should look like rendered in a browser (but it may vary depending on how wide your browser's screen is):
Screen shot of Task 1

Sample 2

to Top
to Top

Here's another sample.

  1. Copy this and paste it into your X20g file after the first sample.

Comment: Heading 1, centered, yellow, with green background:
ALICE'S ADVENTURES IN WONDERLAND

Comment: Heading 4, centered, silver, with red background:
by Lewis Carroll

Comment: Heading 2, centered, silver, with blue background:
Comment: Break between "Chapter III" and "A Caucus-Race and a Long Tale"
CHAPTER III
A Caucus-Race and a Long Tale

Comment: paragraph, justified, aqua, with navy background:
They were indeed a queer-looking party that assembled on the bank--the birds with draggled feathers, the animals with their fur clinging close to them, and all dripping wet, cross, and uncomfortable.

Comment: paragraph, justified, white text with maroon background:
The first question of course was, how to get dry again: they had a consultation about this, and after a few minutes it seemed quite natural to Alice to find herself talking familiarly with them, as if she had known them all her life. Indeed, she had quite a long argument with the Lory, who at last turned sulky, and would only say, 'I am older than you, and must know better'; and this Alice would not allow without knowing how old it was, and, as the Lory positively refused to tell its age, there was no more to be said.

Comment: paragraph, right aligned, navy text with yellow background:
At last the Mouse, who seemed to be a person of authority among them, called out, 'Sit down, all of you, and listen to me! I'll soon make you dry enough!' They all sat down at once, in a large ring, with the Mouse in the middle. Alice kept her eyes anxiously fixed on it, for she felt sure she would catch a bad cold if she did not get dry very soon.

Comment: Make the following paragraphs, all left aligned, and use the following color combinations:
Comment: For paragraphs in which the mouse speaks, black with silver background ;
Comment: For paragraphs in which the lory speaks, green with red background;
Comment: For paragraphs in which the duck speaks, yellow with teal background;
Comment: For paragraphs in which Alice speaks, maroon with pink background;
Comment: For paragraphs in which the dodo speaks, silver with brown background;
Comment: For paragraphs in which the eaglet speaks, silver with black background;

'Ahem!' said the Mouse with an important air, 'are you all ready? This is the driest thing I know. Silence all round, if you please! "William the Conqueror, whose cause was favoured by the pope, was soon submitted to by the English, who wanted leaders, and had been of late much accustomed to usurpation and conquest. Edwin and Morcar, the earls of Mercia and Northumbria--"'

'Ugh!' said the Lory, with a shiver.

'I beg your pardon!' said the Mouse, frowning, but very politely: 'Did you speak?'

'Not I!' said the Lory hastily.

'I thought you did,' said the Mouse. '--I proceed. "Edwin and Morcar, the earls of Mercia and Northumbria, declared for him: and even Stigand, the patriotic archbishop of Canterbury, found it advisable--"'

'Found what?' said the Duck.

'Found it,' the Mouse replied rather crossly: 'of course you know what "it" means.'

'I know what "it" means well enough, when I find a thing,' said the Duck: 'it's generally a frog or a worm. The question is, what did the archbishop find?'

The Mouse did not notice this question, but hurriedly went on, '"--found it advisable to go with Edgar Atheling to meet William and offer him the crown. William's conduct at first was moderate. But the insolence of his Normans--" How are you getting on now, my dear?' it continued, turning to Alice as it spoke.

'As wet as ever,' said Alice in a melancholy tone: 'it doesn't seem to dry me at all.'

'In that case,' said the Dodo solemnly, rising to its feet, 'I move that the meeting adjourn, for the immediate adoption of more energetic remedies--'

'Speak English!' said the Eaglet. 'I don't know the meaning of half those long words, and, what's more, I don't believe you do either!' And the Eaglet bent down its head to hide a smile: some of the other birds tittered audibly.

  1. Again using Notepad and your reference materials, format each part as instructed in the Comments. Remember to save your file after completing each part.
  2. Check the page in a browser. The Comments should still be visible, so you can make sure each part is formatted according to the instructions.
  3. If any part isn't right, check your code against examples in the reference materials, and correct your code.
  4. When each part is correct, put (X)HTML <!-- comment markers --> around the comments. Save your file and check in a browser to make sure the commenhts have all disappeared in the rendered page.
  5. Once again, validate the file and make any corrections necessary

When you're done with this part, this is what it should look like rendered in a browser (but it may vary depending on how wide your browser's screen is):

Submitting the Assignment

to Top
to Top

When you're done, double-check that the assignment meets the specifications above.

Send email to the instructor with the X20g file attached. Be sure your email meets the formal requirements: name, class, section and exercise (X20g), and that it follows standard business-email practice.


to Top About This Document
Audience

to Top

This exercise is for people who are acquainted with the principles of in-line styles (see module X20b) and would benefit from practice with them.

 

Objectives

On successful completion of this module, you will be able to:

  1. Use CSS to apply background color;
  2. Format basic XHTML block and inline entities using inline style;
  3. Use CSS to apply text color;
  4. Use CSS to apply font family, and size
  5. Use CSS to apply text alignment.

Module x20g: Formatting with In-Line Styles (1)
This document is part of a modular instruction series in Computer Instruction. For more information, see the overview or the list of modules in this series, X: XML, etc. This document has been used in the following classes: INP 150.
History

Original: 12 September 2003
Last modification: Monday, 31-Aug-2009 11:48:08 EDT
Copyright
Copyright © 2003, Laurence J. Krieg, Washtenaw Community College
Instructors: You may point to this file in your Web-based materials; however, its location may change without notice.
Students: You are welcome to make a copy for your personal use.
All other uses: Please contact the author, Laurence J. Krieg, for permission: krieg@ieee.org.