Attributes
come in all forms:
|
7. Attributes: Adding interest to your page. Bold headlines and organized lists are nice but theres got to be more to a web page than that. How about some color and variety? Glad you asked, because thats where attributes come in. Dont let the word scare you. Attributes are just special codes placed within the HTML tags that describe how the tags will look. Color Attribute <html> With this code, your web page appears like this in your browser. Notice the attributes: bgcolor and text. They are placed within the <body> tag. Theres that nesting thing again. Attributes never stand alone. Instead, they always appear inside a body tag. Let's look a little closer at the body attribute: <body
bgcolor="#bee3c2">...</body>
It's that simple. Now let's try some more. But first, here's something to remember... Tip
to Remember For
example the hex code for black is #000000, while white is #ffffff. For a complete list of
colors and their hex codes, see: Align Attribute Heres a simple example for the align attribute: <html> <p>My spring
vacation was wonderful, except for the terrible storms we had during the first part of the
week. Snuggle, my dog, enjoyed the walks we had on the beach and Jimmy, my teddy bear,
liked the hotel room. He said the maid was very nice to him.</p> Here is the resulting page as if it were in a browser: You can use the align attribute with all sorts of tags like: headlines, paragraphs, rules, graphics and so on. Width
Attribute My
Spring Vacation The code would
look like this: And here's what it would look like in your browser. Notice how we told the browser to center the rule <hr> tag and make it only 40% the size of the screen. Although this may seem a bit confusing in the beginning, you will find it becomes easier as you use these attributes to help design your web pages. Let's apply what we've learned. Step 1 Load your text editor and open your HTML document we have been working on: firstpage.html Your file should appear as below: <html> <hr> <p>I can also create lists using numbers and bullets. Here is an example of a list with numbers: <ol> Step 2 Let's add some attribute codes to your original HTML file. Enter the code listed below in red: <html> <body
bgcolor="#ffff00" text="#000000"> <hr
align="center" width="50%"> <p>I can also create lists using numbers and bullets. Here is an example of a list with numbers: <ol> Step 3 Save your file. Step 4 If Netscape Navigator is still open, hit the reload button. If not, then load Navigator following steps in Chapter 4. Your resulting page should look like this in your browser. Notice
the new changes:
All created by you! Now let's learn more about text formatting. Go to Chapter 8: Advanced text formatting
|