Get Started With Cascading Style Sheets
Create a Linked Style Sheet
By Matt Rotter and Charity Kahn By editing one style sheet file, you can make global changes to all HTML pages that reference the style sheet. To see this capability in action, copy and paste the following code into a text file, and call it style1.css:
H1, H2, H3, H4, H5 { color: red } The first line of this style sheet makes <H1> through <H5> headers red. The second line colors the page's background gray and makes Arial the default font. The third line defines text within <P> elements as double-spaced (200 percent line-height). The fourth line shrinks <LI> text within <UL> elements to 70 percent of their normal size. The next three lines create classes: the red class makes elements red, and so forth. The last two lines create two IDs: the big ID expands text to 120 percent of its normal size, and the upper ID shifts text to uppercase. Now copy and paste the following code into an HTML document, and call it doc1.html:
<HTML> Now create a second HTML document from the code below, and call it doc2.html:
<HTML> By editing your style1.css file you can make big changes in your HTML documents--without touching them. For instance, you can change the BODY line of style1.css to:
BODY { background-color: #000000; font-family: Courier, monospace; color: #eeeeee } You'll have fun doing this.
Notice that I have added window closing routines to the examples. <CENTER> <TABLE border=3 bordercolor="forestgreen"><TR> <TD align="center" bgcolor="thistle"> <font color="Black"><b>Click to<BR> <INPUT TYPE='BUTTON' VALUE='Close Me Please' onClick='window.close()'> <BR>Close the<BR>Window</b></font> </TD></TR></TABLE> |