previous page

Overview | Create HTML | Create CSS | New HTML | Create Popup | Create Function | User input | Variables | Update Page | Backup | Add Dropdown | Add Loop

next page

Lab 6/7: Introduction to JavaScript

Create a CSS file


1. Create a new CSS file in one of these 2 ways:

a. In NotePad++, click on the "File" menu and choose "New". In NotePad++, go to "Language" and choose "CSS":

screenshot of notepad++

 

Now, you're going to set the colors, font and margins for your entire page (i.e. the whole <body> section of the html page).

2. Type the name of the HTML tag ('body') followed by an opening and closing curly bracket:

body
{
}

 

3. Inside the curly bracket add these 4 attributes

reminder: each line will have this structure: background-color:#333333;

background-color

color

font-family

margin (you can express the margin size as a number of pixels, for example "20px")

 

* check to be sure that each attribute is spelled correctly, and check to be sure that each line ends with a semicolon

4. Save this file as "tickets.css"

 

5. To attach this file to the HTML file, open the HTML file and put this line in the <head> section:

<link rel="stylesheet" type="text/css" href="tickets.css" />

 

6. Look at your HTML file in a browser to be sure everything looks right (does it show the colors and fonts you selected?). If it doesn't check for these common errors:

  • Is the CSS file in the same folder as the HTML file?

  • Are all of the CSS attributes spelled correctly? (To help with this, here is a list of all the attributes)

  • Does each line in the CSS file end with a semi-colon?

 

7. Go back to the Catalyst quiz and answer question #2 & #3

 

Next, you'll learn some new HTML tags to add elements on a page that allow the user to give information to the page