| Takuya Yamashita |
Topic Note 4 CSS RevisedContents1. CSS - Text Properties Overview1.0 Overview 2. Unit - URL2.0 Overview
OverviewText properties allow you to control the appearance of text. It is possible to change the color of a text, increase or decrease the space between characters in a text, align a text, decorate a text, indent the first line in a text, and more. There are three way to embed CSS into HTML code: External Style Sheets, Local Style Sheets, and Inline Style Specification. Inline Style SpecificationFor example, if you want to change a color for the sentence encircled by <P> tag and center the sentence, you can just specify the color in <P> using STYLE="". <P STYLE="color: #000099; text-align: center">Style Sheet</P> Local Style SheetsYou can also define the style in the <STYLE> tag in the <HEAD> tag. <STYLE TYPE="text/css"> Then, you can just encircle the target sentence with <P>. <P>Style Sheet</P>
External Style SheetsThe third ways is to refer the external CSS file in which <P> tag is defined. For instance, externalSytleSheet.css defines the <P> tag. ------ externalStyleSheet.css begin ------- P { color: #000099; text-align: center } ------ externalStyleSheet.css end --------- Then the external CSS is referred in the <HEAD> tag. <LINK REL="stylesheet" HREF="externalStyleSheet.css" TYPE="text/css"> Finally, you can just encircle the target sentence with <P>. <P>Style Sheets</P> Using either three ways above, we can get exactly the same result:
Style SheetsThe overview of each property is in the following table:
Table Property Summary
A URL value is given by url(actualUrl), where actualUrl is, for example, http://www2.hawaii.edu/~takuyay/myPicture.gif. The URL may be optionally quoted with either single (') or double (") quotes and may contain whitespace before or after the (optionally quoted) URL. Parentheses, commas, spaces, single quotes, or double quotes in the URL must be escaped with a backslash. Partial URLs are interpreted relative to the style sheet source, not to the HTML source. Note that Netscape Navigator 4.x incorrectly interprets partial URLs relative to the HTML source. Given this bug, authors may wish to use full URLs where possible.
BODY { background-image: url(myPicture.gif) } BODY { background-image: url(http://www2.hawaii.edu/~takuyay/myPicture.gif) } BODY { background-image: url( myPicture.gif ) } BODY { background-imgae: url('myPicture.gif') } BODY { background-imgae: url("myPicture.gif") }
url
In the <HEAD> tag : <STYLE TYPE="TEXT/CSS"> In the <TD> tag of the <TABLE> tag : <TD COLSPAN="2"
CLASS="urlExample" HEIGHT="87">
In the code example, the style sheet for the backgroud is defined, using url. You can also define the this property in the separate CSS file so that you can import the file, using <LINK> tag. For instance, <LINK REL="stylesheet" HREF="../yourStyleSheetName.css" TYPE="text/css">. After describing that in the head tag, you can write the tag wherever you wan to insert. In the example, the code is inserted in the <TR> tag of the <Table> so that the output looks the above.
|
|
| © 2002 TAKUYA YAMASHITA ALL RIGHTS RESERVED |