eg-259:css
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
eg-259:css [2012/01/20 15:22] – [External style sheets] eechris | eg-259:css [2012/01/20 16:39] (current) – [The Structural and Presentation Layers] eechris | ||
---|---|---|---|
Line 117: | Line 117: | ||
<code html> | <code html> | ||
< | < | ||
- | < | + | < |
- | </link> | + | |
</ | </ | ||
</ | </ | ||
Line 128: | Line 127: | ||
===== Selector Forms ===== | ===== Selector Forms ===== | ||
- | * There are five specific types of selector for style sheets. These control what XHTML elements (tags) a style is applied to. | + | * There are five specific types of selector for style sheets. These control what HTML elements (tags) a style is applied to. |
* The Style selectors are: | * The Style selectors are: | ||
- // | - // | ||
Line 211: | Line 210: | ||
* '': | * '': | ||
* '': | * '': | ||
- | * Example: [[/~eechris/ | + | * Example: [[/ |
---- | ---- | ||
- | <code html> | + | <code html|Illustrates the :hover and :focus pseudo classes> |
- | <?xml version = " | + | < |
- | < | + | |
- | " | + | |
<!-- pseudo.html | <!-- pseudo.html | ||
- | Illustrates the :hover and :focus pseudo classes | + | Illustrates the :hover and :focus pseudo classes |
- | | + | --> |
- | < | + | <html lang=" |
- | < | + | < |
- | <style type = " | + | <meta charset=" |
- | input:hover {color: red;} | + | |
- | input:focus {color: green;} | + | <style type=" |
+ | input:hover { | ||
+ | | ||
+ | | ||
+ | input:focus { | ||
+ | | ||
+ | | ||
</ | </ | ||
</ | </ | ||
< | < | ||
- | <form action = ""> | + | <form action=""> |
<p> | <p> | ||
Your name: | Your name: | ||
- | <input type = " | + | <input type=" |
</p> | </p> | ||
</ | </ | ||
Line 329: | Line 331: | ||
===== Examples of the Use of Font ===== | ===== Examples of the Use of Font ===== | ||
- | * Example 1: [[/~eechris/ | + | * Example 1: [[/ |
- | * Example 2: [[/~eechris/ | + | * Example 2: [[/ |
---- | ---- | ||
//Example 1// | //Example 1// | ||
- | <code html> | + | <code html|An example to illustrate font properties> |
- | <?xml version = " | + | < |
- | < | + | |
- | " | + | |
<!-- fonts.html | <!-- fonts.html | ||
- | An example to illustrate font properties | + | An example to illustrate font properties |
- | | + | --> |
- | < | + | <html lang=" |
- | < | + | < |
- | < | + | <meta charset=" |
- | p.big {font-size: 14pt; | + | |
- | | + | < |
- | | + | p.big { |
- | } | + | |
- | p.small {font: 10pt bold ' | + | font-style: italic; |
- | h2 {font-family: | + | font-family: |
- | font-size: 24pt; font-weight: | + | } |
- | h3 {font-family: | + | p.small { |
- | </ | + | |
+ | | ||
+ | h2 { | ||
+ | | ||
+ | font-size: 24pt; | ||
+ | | ||
+ | | ||
+ | h3 { | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
</ | </ | ||
< | < | ||
Line 371: | Line 381: | ||
//Example 2// | //Example 2// | ||
- | The XHTML code [[/~eechris/ | + | The HTML code [[/ |
- | <code html> | + | <code html|An example to test external style sheets> |
- | <?xml version = " | + | < |
- | < | + | |
- | " | + | |
<!-- fonts2.html | <!-- fonts2.html | ||
- | An example to test external style sheets | + | An example to test external style sheets |
- | | + | --> |
- | < | + | <html lang=" |
- | < | + | < |
- | <link rel = " | + | <meta charset=" |
- | | + | |
+ | <link rel = " | ||
</ | </ | ||
< | < | ||
Line 398: | Line 406: | ||
</ | </ | ||
</ | </ | ||
- | The External Stylesheet [[/~eechris/ | + | The External Stylesheet [[/ |
- | <code css> | + | <code css|an external style sheet for use with fonts2.html> |
/* styles.css - an external style sheet | /* styles.css - an external style sheet | ||
- | for use with fonts2.html | + | for use with fonts2.html |
- | */ | + | */ |
- | p.big {font-size: 14pt; | + | p.big { |
- | | + | |
- | | + | font-style: italic; |
- | } | + | font-family: |
- | + | } | |
- | p.small {font: 10pt bold ' | + | p.small { |
- | + | | |
- | h2 {font-family: | + | } |
- | font-size: 24pt; font-weight: | + | h2 { |
- | + | | |
- | h3 {font-family: | + | font-size: 24pt; |
- | font-size: 18pt} | + | |
+ | } | ||
+ | h3 { | ||
+ | | ||
+ | font-size: 18pt | ||
+ | } | ||
</ | </ | ||
- | //Note// how much smaller, and easier to understand, is the XHTML **without** the stylesheet. Also, note that the stylesheet can be used with a collection of XHTML documents. | + | //Note// how much smaller, and easier to understand, is the HTML **without** the stylesheet. Also, note that the stylesheet can be used with a collection of HTML documents. |
===== Some Additional Properties Related to Fonts ===== | ===== Some Additional Properties Related to Fonts ===== | ||
- | * The '' | + | * The '' |
* '' | * '' | ||
---- | ---- | ||
Example3 | Example3 | ||
- | <code html> | + | <code html|An example to illustrate some additional font properties> |
- | <?xml version = " | + | < |
- | < | + | |
- | " | + | |
<!-- fonts3.html | <!-- fonts3.html | ||
- | An example to test external style sheets | + | An example to illustrate some additional font properties |
- | | + | --> |
- | < | + | <html lang=" |
- | < | + | < |
- | < | + | <meta charset=" |
- | p.through {text-decoration: | + | |
- | p.over {text-decoration: | + | < |
- | p.under {text-decoration: | + | p.through { |
+ | | ||
+ | | ||
+ | p.over { | ||
+ | | ||
+ | | ||
+ | p.under { | ||
+ | | ||
+ | | ||
</ | </ | ||
</ | </ | ||
Line 501: | Line 519: | ||
| '' | | '' | ||
- | * Example: [[/~eechris/ | + | * Example: [[/ |
---- | ---- | ||
<code html> | <code html> | ||
- | <?xml version = " | + | < |
- | < | + | |
- | " | + | |
<!-- sequence_types.html | <!-- sequence_types.html | ||
- | An example to illustrate sequence type styles | + | An example to illustrate sequence type styles |
- | | + | --> |
- | < | + | <html lang=" |
- | < | + | < |
- | < | + | <meta charset=" |
- | ol {list-style-type: | + | |
- | ol ol {list-style-type: | + | < |
- | ol ol ol {list-style-type: | + | ol { |
+ | | ||
+ | | ||
+ | ol ol { | ||
+ | | ||
+ | | ||
+ | ol ol ol { | ||
+ | | ||
+ | | ||
</ | </ | ||
</ | </ | ||
Line 524: | Line 547: | ||
<h3> Aircraft Types </h3> | <h3> Aircraft Types </h3> | ||
<ol> | <ol> | ||
- | <li> General Aviation (piston-driven engines) | + | <li> |
+ | | ||
<ol> | <ol> | ||
- | <li> Single-Engine Aircraft | + | <li> |
+ | | ||
<ol> | <ol> | ||
- | <li> Tail wheel </ | + | <li> |
- | <li> Tricycle </ | + | |
- | </ol> | + | |
- | </li> | + | <li> |
- | <li> Dual-Engine Aircraft | + | |
+ | | ||
+ | </ | ||
+ | </ | ||
+ | <li> | ||
+ | | ||
<ol> | <ol> | ||
- | <li> Wing-mounted engines </ | + | <li> |
- | <li> Push-pull fuselage-mounted engines </li> | + | |
+ | | ||
+ | <li> | ||
+ | | ||
+ | | ||
</ol> | </ol> | ||
</li> | </li> | ||
- | </ | + | </ol> |
</li> | </li> | ||
- | <li> Commercial Aviation (jet engines) | + | <li> |
+ | | ||
<ol> | <ol> | ||
- | <li> Dual-Engine | + | <li> |
+ | | ||
<ol> | <ol> | ||
- | <li> Wing-mounted engines </ | + | <li> |
- | <li> Fuselage-mounted engines </li> | + | |
+ | | ||
+ | <li> | ||
+ | | ||
+ | | ||
</ol> | </ol> | ||
- | </li> | + | </ |
- | <li> Tri-Engine | + | <li> |
+ | | ||
<ol> | <ol> | ||
- | <li> Third engine in vertical stabilizer </ | + | <li> |
- | <li> Third engine in fuselage </li> | + | |
+ | | ||
+ | <li> | ||
+ | | ||
+ | | ||
</ol> | </ol> | ||
</li> | </li> | ||
Line 611: | Line 656: | ||
===== Using Colours ===== | ===== Using Colours ===== | ||
- | * The '' | + | * The '' |
- | * The '' | + | * The '' |
---- | ---- | ||
Example of the use of the '' | Example of the use of the '' | ||
- | <code html> | + | <code html|An example to illustrate the color property> |
- | <?xml version = " | + | < |
- | < | + | |
- | " | + | |
<!-- back_color.html | <!-- back_color.html | ||
- | An example to illustrate the color property | + | An example to illustrate the color property |
- | | + | --> |
- | < | + | <html lang=" |
- | < | + | < |
- | < | + | <meta charset=" |
- | th.red {color: red} | + | |
- | th.orange {color: orange} | + | < |
- | </ | + | th.red { |
+ | | ||
+ | | ||
+ | th.orange { | ||
+ | | ||
+ | | ||
+ | </ | ||
</ | </ | ||
< | < | ||
- | | + | |
- | <table border = " | + | <table border = " |
- | < | + | < |
- | <th class = " | + | <th class = " |
- | <th class = " | + | <th class = " |
- | <th class = " | + | <th class = " |
- | </ | + | </ |
- | </ | + | </ |
</ | </ | ||
</ | </ | ||
Line 646: | Line 694: | ||
Example of the use of the '' | Example of the use of the '' | ||
- | <code html> | + | <code html|An example to illustrate the background-color property> |
- | <?xml version = " | + | < |
- | < | + | |
- | " | + | |
<!-- back_color.html | <!-- back_color.html | ||
- | An example to illustrate the background-color property | + | An example to illustrate the background-color property |
- | | + | --> |
- | < | + | <html lang=" |
- | < | + | < |
- | < | + | <meta charset=" |
- | p.redback {font-size: 24pt; | + | |
- | | + | < |
- | | + | p.redback { |
+ | | ||
+ | color: blue; | ||
+ | background-color: | ||
} | } | ||
</ | </ | ||
Line 689: | Line 737: | ||
want on the right | want on the right | ||
- | Example: [[/~eechris/ | + | Example: [[/ |
- | + | ||
- | <code html> | + | |
- | <?xml version = " | + | |
- | < | + | |
- | " | + | |
+ | <code html|An example to illustrate the float property> | ||
+ | < | ||
<!-- float.html | <!-- float.html | ||
- | An example to illustrate the float property | + | An example to illustrate the float property |
- | | + | --> |
- | < | + | <html lang=" |
- | < | + | < |
- | < | + | <meta charset=" |
- | img {float: right} | + | |
+ | < | ||
+ | img { | ||
+ | | ||
+ | | ||
</ | </ | ||
</ | </ | ||
Line 710: | Line 759: | ||
</p> | </p> | ||
<p> | <p> | ||
- | This is a picture of a Cessna 210. The 210 is the flagship | + | This is a picture of a Cessna 210. The 210 is the flagship |
- | single-engine Cessna aircraft. Although the 210 began as a | + | single-engine Cessna aircraft. Although the 210 began as a |
- | four-place aircraft, it soon acquired a third row of seats, | + | four-place aircraft, it soon acquired a third row of seats, |
- | stretching it to a six-place plane. The 210 is classified | + | stretching it to a six-place plane. The 210 is classified |
- | as a high-performance airplane, which means its landing | + | as a high-performance airplane, which means its landing |
- | gear is retractable and its engine has more than 200 | + | gear is retractable and its engine has more than 200 |
- | horsepower. In its first model year, which was 1960, | + | horsepower. In its first model year, which was 1960, |
- | the 210 was powered by a 260-horsepower fuel-injected | + | the 210 was powered by a 260-horsepower fuel-injected |
- | six-cylinder engine that displaced 471 cubic inches. | + | six-cylinder engine that displaced 471 cubic inches. |
- | The 210 is the fastest single-engine airplane ever | + | The 210 is the fastest single-engine airplane ever |
built by Cessna. | built by Cessna. | ||
</p> | </p> | ||
Line 749: | Line 798: | ||
* '' | * '' | ||
* Border width and colour can be specified for any of the four borders (e.g., '' | * Border width and colour can be specified for any of the four borders (e.g., '' | ||
- | * Example: [[/~eechris/ | + | * Example: [[/ |
---- | ---- | ||
- | <code html> | + | <code html|An example of a simple table with various borders> |
- | <?xml version = " | + | < |
- | < | + | |
- | " | + | |
<!-- borders.html | <!-- borders.html | ||
- | An example of a simple table with various borders | + | An example of a simple table with various borders |
- | | + | --> |
- | < | + | <html lang=" |
- | < | + | < |
- | < | + | <meta charset=" |
- | table {border-top-width: | + | |
- | | + | < |
- | | + | table { |
- | | + | |
- | | + | border-bottom-width: |
- | | + | border-top-color: |
- | } | + | border-bottom-color: |
- | p {border-style: | + | border-top-style: |
- | | + | border-bottom-style: |
- | } | + | } |
+ | p { | ||
+ | | ||
+ | | ||
+ | border-color: | ||
+ | } | ||
</ | </ | ||
</ | </ | ||
< | < | ||
<table border = " | <table border = " | ||
- | < | + | < |
+ | | ||
+ | | ||
<tr> | <tr> | ||
- | <th> </th> | + | < |
<th> Apple </th> | <th> Apple </th> | ||
<th> Orange </th> | <th> Orange </th> | ||
Line 788: | Line 841: | ||
<th> Breakfast </th> | <th> Breakfast </th> | ||
<td> 0 </td> | <td> 0 </td> | ||
- | <td> 0 </td> | + | |
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 831: | Line 884: | ||
* Padding -- the distance between the content of an element and its border | * Padding -- the distance between the content of an element and its border | ||
* Controlled by '' | * Controlled by '' | ||
- | * Example: [[/~eechris/ | + | * Example: [[/ |
---- | ---- | ||
- | <code html> | + | <code html|An example to illustrate margins and padding> |
- | < | + | < |
- | " | + | |
<!-- marpads.html | <!-- marpads.html | ||
- | An example to illustrate margins and padding | + | An example to illustrate margins and padding |
- | | + | --> |
- | < | + | < |
- | < | + | < |
- | < | + | <meta charset=" |
- | p.one | + | |
- | | + | < |
- | | + | p.one { |
- | | + | |
- | } | + | padding: 0.2in; |
- | p.two | + | background-color: |
- | | + | border-style: |
- | | + | } |
- | | + | p.two { |
- | } | + | |
- | p.three {margin: 0.3in; | + | padding: 0.3in; |
- | | + | background-color: |
- | | + | border-style: |
- | | + | } |
- | } | + | p.three { |
- | p.four | + | |
- | | + | padding: 0.1in; |
- | p.five | + | background-color: |
- | | + | border-style: |
- | } | + | } |
+ | p.four { | ||
+ | | ||
+ | background-color: | ||
+ | | ||
+ | p.five { | ||
+ | | ||
+ | background-color: | ||
+ | } | ||
</ | </ | ||
</ | </ | ||
Line 873: | Line 932: | ||
<p class = " | <p class = " | ||
Now is the time for all good Web programmers to | Now is the time for all good Web programmers to | ||
- | learn to use style sheets. <br /> [margin = 0.2in, | + | learn to use style sheets. |
+ | | ||
+ | | ||
padding = 0.2in] | padding = 0.2in] | ||
</p> | </p> | ||
<p class = " | <p class = " | ||
Now is the time for all good Web programmers to | Now is the time for all good Web programmers to | ||
- | learn to use style sheets. <br /> [margin = 0.1in, | + | learn to use style sheets. |
+ | | ||
+ | | ||
padding = 0.3in] | padding = 0.3in] | ||
</p> | </p> | ||
<p class = " | <p class = " | ||
Now is the time for all good Web programmers to | Now is the time for all good Web programmers to | ||
- | learn to use style sheets. <br /> [margin = 0.3in, | + | learn to use style sheets. |
+ | | ||
+ | | ||
padding = 0.1in] | padding = 0.1in] | ||
</p> | </p> | ||
<p class = " | <p class = " | ||
Now is the time for all good Web programmers to | Now is the time for all good Web programmers to | ||
- | learn to use style sheets. <br /> [margin = 0.4in, | + | learn to use style sheets. |
+ | | ||
+ | | ||
no padding, no border] | no padding, no border] | ||
</p> | </p> | ||
<p class = " | <p class = " | ||
Now is the time for all good Web programmers to | Now is the time for all good Web programmers to | ||
- | learn to use style sheets. <br /> [padding = 0.4in, | + | learn to use style sheets. |
+ | | ||
+ | | ||
no margin, no border] | no margin, no border] | ||
</p> | </p> | ||
Line 908: | Line 977: | ||
* The '' | * The '' | ||
- | * Example: [[/~eechris/ | + | * Example: [[/ |
* Repetition can be controlled | * Repetition can be controlled | ||
* '' | * '' | ||
Line 915: | Line 984: | ||
---- | ---- | ||
- | <code html> | + | <code html|An example to illustrate background images> |
- | <?xml version = " | + | < |
- | < | + | |
- | " | + | |
<!-- back_image.html | <!-- back_image.html | ||
- | An example to illustrate background images | + | An example to illustrate background images |
- | | + | --> |
- | < | + | <html lang=" |
- | < | + | < |
- | < | + | <meta charset=" |
- | body {background-image: | + | |
- | p {margin-left: | + | < |
- | | + | body { |
+ | | ||
+ | | ||
+ | p { | ||
+ | | ||
+ | | ||
+ | margin-top: 50px; | ||
+ | | ||
+ | | ||
+ | | ||
</ | </ | ||
</ | </ | ||
Line 933: | Line 1009: | ||
<p > | <p > | ||
The Cessna 172 is the most common general aviation airplane | The Cessna 172 is the most common general aviation airplane | ||
- | in the world. It is an all-metal, single-engine piston, | + | in the world. It is an all-metal, single-engine piston, |
high-wing four-place monoplane. It has fixed-gear and is | high-wing four-place monoplane. It has fixed-gear and is | ||
categorized as a non-high-performance aircraft. The current | categorized as a non-high-performance aircraft. The current | ||
model is the 172R. | model is the 172R. | ||
- | The wingspan of the 172R is 36' | + | The wingspan of the 172R is 36' |
gallons in two tanks, one in each wing. The takeoff weight | gallons in two tanks, one in each wing. The takeoff weight | ||
is 2,450 pounds. Its maximum useful load is 837 pounds. | is 2,450 pounds. Its maximum useful load is 837 pounds. | ||
- | The maximum speed of the 172R at sea level is 142 mph. | + | The maximum speed of the 172R at sea level is 142 mph. |
The plane is powered by a 360 cubic inch gasoline engine | The plane is powered by a 360 cubic inch gasoline engine | ||
- | that develops 160 horsepower. The climb rate of the 172R | + | that develops 160 horsepower. The climb rate of the 172R |
at sea level is 720 feet per minute. | at sea level is 720 feet per minute. | ||
</p> | </p> | ||
Line 1004: | Line 1080: | ||
* [[eg-259: | * [[eg-259: | ||
* [[eg-259: | * [[eg-259: | ||
- | * [[eg-259: | + | * [[eg-259: |
* [[eg-259: | * [[eg-259: |
eg-259/css.1327072943.txt.gz · Last modified: 2012/01/20 15:22 by eechris