Assignment Module X20h

Formatting with In-Line Styles
for HTML Coders


Contents


Overview

Cascading Style Sheets can be applied to an HTML document in any of three ways:

  • In-line
  • Embedded (in the document's <head> area)
  • Linked or imported from separate files

    In this exercise, you will be using the first of these methods to format a few of Aesop's fables.


Getting Started

to Top

Save your XHTML template file as Aesop.htm, and title the page, "Sarah Strong's Fables" (changing Sarah Strong to your own name). Make sure your name is listed as author.

Open file aesop_fables.txt, copy the text, and paste it into the body of your HTML file.

Each fable consists of three parts:

  1. Title
  2. Story
  3. Moral

You will be formatting each part with its own unique style, but first you will need to make each part a separate entity. So...

  1. Add <h1> to the title of the first fable, and </h1> to the end of it.
  2. Add <p> to the beginning and </p> to the end of the story part of the first fable.
  3. Add <p> to the beginning and </p> to the end of the moral part of the first fable.
  4. In the same way, mark up the title, story, and moral of each of the remaining three fables.
  5. Check in a browser to make sure there are four separate stories, each with their three parts.

When it looks good, go on to the next part. You will be adding styles to the <h1> and <p> tag of each part of each fable. Consult your textbook or the "Style Toolkits" in module X20b for the syntax necessary to format according these instructions.

Fable 1

to Top

to Top

We'll format this in a conservative but attractive manner.

Title: 14 point Verdana, Arial, Helvetica, or sans-serif
Note: a "point" is a printers' measure equivalent to 1/72 of an inch. In CSS, it is abbreviated pt, like this: font-size: 14pt;

Story: 11 point Georgia, Times New Roman, or serif

Moral:

Same font and size as the story, font-style italic.
Make the word "Moral" strong.

Fable 2

to Top
to Top

On this fable, let's put in interesting colors. Use the same fonts and sizes as in the first fable, but add:

Title:

Medium green: #009900
Make the background pale yellow: #ffffcc
Strengthen the title by making the font-weight bolder

Story: Medium teal: #009999

Moral: Strong red: #cc0000

Fable 3

to Top
to Top

In the third fable, we'll add borders and text alignment.

Title:

Center the title
Around the tile, put a border 3 pixels wide whose color is dark brown: #663300
Make the background pale brown: #ffcc99
The text should be the same color as the border
Font-family Georgia, Times New Roman, or serif
Size 18 points

Story:

Justify the text
Put a bright yellow border 1 pixel wide around the story: #ffff00
Use font-family Verdana, Arial, Helvetica, or sans-serif
Size the font to 10 points

Moral:

Right-align the moral
Put a bright red border 2 pixels wide around the moral: #ff0000
Use the same font-family as the story, but make it 11 points
Make the background strong red: #cc0000
Color the text bright yellow: #ffff00

Fable 4

to Top
to Top

For the fourth fable, experiment with colors, alignments, sizes, and fonts.

Title: Large and colorful

Story: Remember this is about a lion - use appropriate colors

Moral: Be creative!

Submitting the Assignment

to Top

to Top

When you're done, double-check that the assignment meets the specifications above, and that all links are functional.

Attach your file (Aesop.htm) to email to the instructor. Be sure your email meets the formal requirements: name, class, section and exercise (x20h), and that it follows standard business-email practice. (Printed output is not required for this exercise.)

 


to Top About This Document
Audience

to Top

This exercise is for people who are familiar with the concepts of CSS and are ready to begin formatting with simple, in-line CSS.

 

Objectives

On successful completion of this module, you will be able to use in-line CSS to apply:

  1. background color and image;
  2. text color;
  3. element borders;
  4. font family, size, style, and weight;
  5. text alignment, decoration, and indent;

Module x20h:Formatting with In-Line Styles (2)
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, XHTML, DHTML, CSS". This document has been used in the following classes: INP 150, INP 270.
History:
Original: 10 March 2003
Last modification: Monday, 31-Aug-2009 11:48:08 EDT
Copyright
Copyright © 2004, 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.