Exercise 1 – The Style Attribute
- Open Notepad and create a Web page called “Style_Attributes.htm” and save it in your HTML folder. In the <TITLE> "Using the Style Attribute”. Be sure to include all the proper opening and closing HTML tags that a Web page requires.
- Inside the opening and closing <BODY> tags insert the following code:
<H1>Showing
Cascades</H1>
<DIV
style="background-color:red;color:white;">
This text will be shown with white text on a
red background.
<DIV>So will this text, which is in a
DIV contained in the first.</DIV>
<DIV
style="background-color:blue">
This text has a blue background, and inherits (or cascades) the white text.
<DIV
style="color:black;">Meanwhile, this inherits the blue background,
from the most immediate parent element, but sets the text color to black.
</DIV>
</DIV>
This text is back to white on red, because it
inherits the topmost style.
</DIV>
<DIV> This has no styles associated with it, so
should appear as black on white
(or gray, if viewed in certain Netscape
browsers)
</DIV>
Make sure you save your file
periodically as you put in your code to make sure all your code is saved. You will also need to make sure the file has
been saved before displaying it in a browser.
- Open the file in Internet Explorer. (Do not close Internet Explorer after you view the file.) The file should look like this:
- If the file does not display correctly, go back to your Notepad file and check that all code has been properly typed. Make any corrections you find. After making corrections, resave the file and go back and refresh your browser by either clicking on the “refresh” icon or going to View – Refresh in the menu bar. Keep repeating this process until your page displays properly in Internet explorer.

0 comments:
Post a Comment