CBTE 162: Web Page Creation : Exercises

Exercise 2B: Using Basic CSS

In the second part of this Exercise we will learn some basic CSS to style our pages. Follow the Exercise 2B Assignment Instructions on BlackBoard. Review DEMO & VIDEO pages as needed.

Using Simple CSS to Style your Elements

CSS Document Styles

Add these styles in the HEAD of your HTML Document. Use them to style the Elements you are using in your page content.

<style> </style>

Be sure to add the attribute to tell the browser you are using CSS to add style:

  • type="text/css"

CSS uses SELECTORS, PROPERTIES and VALUES instead of elements, attributes and values that we use in HTML. Use the selectors to choose what you will be styling on your page. See the DEMO pages for more information.

You can also add comments in your CSS styles to remind yourself of what a style means, or where a group of styles begins and ends.


<title> </title>

<style type="text/css">

body {background-color: red;
font-family: Helvetica, Arial, san-serif;
color: white; }

h1 {font-size: 45px;
color: #faffcc; }

/* This is a CSS Comment. I am styling my whole page by using the body tag as a selector and all the h1 tags too. */



You can keep adding more styles into your Document Styles. Just add them between the style tags.

CSS Inline Styles

This styles are added right into the main body area of your page. You can style as little as one letter, or a whole group of content by add the SPAN Element with the Style Attribute. Or you can add the Style Attribute to an Opening Tag of an Element on the page.

<span> </span>

  • style="property:value;"

Using the Span Tag with the CSS style attribute. In this example we added the span tag inside another tag:

<h2> This is an H2 Header with some
<span style="font-size: 60px; color: hotpink; font-family: Comic Sans MS, serif;">CSS Added
</span> To It </h2>

Adding the CSS style attribute to an opening tag. This will add the style until the tag closes.

<p style="font-size: 16px; color: orange; letter-spacing: 1px;">This is a paragraph that has CSS styles added to it to make the whole paragraph look different.... </p>

There are a lot of CSS styles you can use. Try some simple ones to start with.

Exercise Two Grading Rubric
Item/Points 1 2 3
Coding Some Most All correct
Function Some Most All
Requirements Some Most All
Effort Minimal Basic Requirements Above & Beyond
Deadline More than one class late 1 Class Late On Time


This exercise is worth 15 points.

Coding (3)
Functionality (3)
Meeting project requirements (3)
Your effort (3)
Meeting deadlines (3)

Useful Links

List of Supported HTML Color Names with hex codes included

Some Basic CSS Styles