css in xhtml continued please use speaker notes for additional information!

41
CSS in XHTML continued Please use speaker notes for additional information!

Upload: shanon-greene

Post on 28-Dec-2015

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSS in XHTML continued Please use speaker notes for additional information!

CSS in XHTML continued

Please use speaker notes for additional information!

Page 2: CSS in XHTML continued Please use speaker notes for additional information!

cssAx.htmlcssAx.htmlbody { font-family: "Times New Roman", "Times Roman", serif; color: green; background: pink; margin-top: 1.5in; margin-left: .5in; margin-right: .5in }p { text-indent: .5in; margin-top: .25in; color: blue }p b { color: purple; }table { background: white; }td { color: purple; }h1, h2, h3 { font-family: Helvetica, Arial, sans-serif; color: red; }

cssBx.htmlcssBx.htmlblockquote { color: #EEAABB; font-style: italic; font-size: 48pt; }h1, h2, h3 { font-family: Helvetica, Arial, sans-serif; color: blue; text-decoration: underline; text-transform: uppercase; font-size: 36pt; }.tocenter { text-align: center; color: pink; }.toright { text-align: right; color: orange; font-style: italic; font-weight: bold; }

Page 3: CSS in XHTML continued Please use speaker notes for additional information!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>More CSS</title><style type="text/css">@import "cssAx.css";@import "cssBx.css";h1 {color: yellow; background: green;}table { border: solid thick; padding: 10; border-color: purple; }td, th { border: solid thin; }</style></head><body><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><div>We are now testing the sheet to see what will come up.</div><p>This is a test of a paragraph. I want it to go on for a little while so I am typing aline of comments. Note that text/css defines the language as Cascading Style Sheets and isnot required. The @import allows you to use multiple style sheets - they must proceedall other style sheet entries.</p><table width="100%"><tr><td class="toright">This is the first cell.</td><td class= "tocenter">And this is another cell.</td></tr>

Page 4: CSS in XHTML continued Please use speaker notes for additional information!

<tr> <td colspan = "2">These are merged cells</td></tr></table><p>Note that if a <b>bold is in a paragraph it will be purple</b> because of the P B in cssA. However if a bold is outside a paragraph, it will retain the default color. The P B in thestyle simply says P that contain the B for bold will have these attributes. This is calledusing Descendant Selectors.</p><div>This is a <b>test of that statement</b> - does it work?</div></body></html>

p b { color: purple; }

Page 5: CSS in XHTML continued Please use speaker notes for additional information!
Page 6: CSS in XHTML continued Please use speaker notes for additional information!

Note the first part of this page appears on the previous slide.

Page 7: CSS in XHTML continued Please use speaker notes for additional information!
Page 8: CSS in XHTML continued Please use speaker notes for additional information!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Testing CSS</title><style type="text/css">h1 { border: 2px solid; padding: 5px; text-align:center; color:red; }h2 { border: 4px inset; padding: 5px; text-align:center; color:blue; }h3 { border: 4px groove; padding: 5px; text-align:center; color:yellow; background-color:green; }H4 { display:inline; font-size:24 pt; } P { letter-spacing:10pt; }

</style></head><body><h1>Hello world!</h1><h2>Hello world!</h2><h3>Hello world!</h3><div>This is the first part of <h4>the line </h4> which now ends.</div><p>The quick brown fox jumped over the lazy dog</p></body></html>

Absolute measurements:

A pica (pc) is a standard publishing unit that is equal to 12 points.

A point (pt) is another standard publishing unit where 1 inch is equal to 72 points

Relative measurements:

em is the width of M in the font

ex is the height of x in the font

Pixel (px) is the size of the pixel on the monitor

Page 9: CSS in XHTML continued Please use speaker notes for additional information!
Page 10: CSS in XHTML continued Please use speaker notes for additional information!
Page 11: CSS in XHTML continued Please use speaker notes for additional information!
Page 12: CSS in XHTML continued Please use speaker notes for additional information!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Positioning using CSS</title><style type="text/css">body { background: beige; }#cis { z-index: 3; position: absolute; top: 16 px; left: 16 px; }#snow { z-index: 1; position: absolute; top: 16 px; left: 16 px; }#flag { z-index: 2; position: absolute; top: 16 px; left: 16 px; }</style></head>

<body><div id="snow"><img src="snow.gif" height="400" width="600" alt="Snow image" /></div><div id="flag"><img src="flag.gif" height="100" width="100" alt="Flag image" /></div><div id="cis"><img src="CISa.gif" height="200" width="200" alt="CIS image" /></div></body></html>

Page 13: CSS in XHTML continued Please use speaker notes for additional information!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Positioning using CSS</title><style type="text/css">body { background: beige; }.cis { z-index: 2; position: absolute; top: 16 px; left: 16 px; }.snow { z-index: 0; position: absolute; top: 16 px; left: 16 px; }.flag { z-index: 1; position: absolute; top: 16 px; left: 16 px; }</style></head>

<body><div class="snow"><img src="snow.gif" height="400" width="600" alt="Snow image" /></div><div class="flag"><img src="flag.gif" height="100" width="100" alt="Flag image" /></div><div class="cis"><img src="CISa.gif" height="200" width="200" alt="CIS image" /></div></body></html>

Page 14: CSS in XHTML continued Please use speaker notes for additional information!
Page 15: CSS in XHTML continued Please use speaker notes for additional information!
Page 16: CSS in XHTML continued Please use speaker notes for additional information!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Another CSS test using background images</title><style type="text/css"> body { background-color: beige; color: green; font-size: 1.5em; background-image: url(CISa.gif); background-repeat: repeat-x; background-attachment: scroll; } p { color: blue; font-size: 2em; font-family: sans-serif; } .bright { font-weight: bold; color: red; } .dim { color: brown; }</style></head>

Page 17: CSS in XHTML continued Please use speaker notes for additional information!

<body><div>Here I go with entering information to make multiple lines again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and I hope this is enough!</div><p class="dim"> Here I go with entering information to make multiple lines again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and I hope this is enough!</p><p> Here I go with entering information to make multiple lines again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and I hope this is enough!<span class="bright">This data is going to be brighterthen the rest!</span> Here I go with entering information to make multiple lines again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and I hope this is enough!</p></body></html>

Page 18: CSS in XHTML continued Please use speaker notes for additional information!
Page 19: CSS in XHTML continued Please use speaker notes for additional information!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Another CSS test using background images</title><style type="text/css"> body { background-color: beige; color: green; font-size: 1.5em; background-image: url(CISa.gif); background-repeat: repeat-y; background-attachment: scroll; } p { color: blue; font-size: 2em; font-family: sans-serif; } .bright { font-weight: bold; color: red; } .dim { color: brown; }</style></head>

Page 20: CSS in XHTML continued Please use speaker notes for additional information!
Page 21: CSS in XHTML continued Please use speaker notes for additional information!
Page 22: CSS in XHTML continued Please use speaker notes for additional information!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Another CSS Test</title><style type="text/css"> body { background-image: url(CISa.gif); background-position: top left; background-repeat: no-repeat; background-attachment: fixed; background-color: beige; color: green; font-size: 1.5em; font-family: serif; } p { color: blue; font-size: 2em; font-family: sans-serif; } .bright { font-weight: bold; color: red; } .dim { color: brown; }</style></head>

Page 23: CSS in XHTML continued Please use speaker notes for additional information!

<body><h1>Be aware that many of the advanced features work differently in Netscape and Explorer and in different versions of them. You need to be very sure to check in all versions and types where you wish people to see your work.</h1><h1>Also, please take note of my terrible style - these are clearly examples of what not to do.</h1><div>This is how it is supposed to work! Background-position: has possibilities of top, bottom, center, left and right. Background-repeat: has no-repeat, the default of repeat, repeat-x which should tile the image horizontally only and repeat-y which should repeat the image vertically only. Background-attachment: fixed is supposed to leave in place while scroll is supposed to gowith the user as they scroll.<br />Try it - try in both navigator and explorer and in different versions - the older versionsof the browsers are the problem!<br />SPAN is a way to apply a class to a particular set of things - it works! Note also that em stands for the size of the font.<br /><br />This is how it is supposed to work! Background-position: has possibilities of top, bottom, center, left and right. Background-repeat: has no-repeat, the default of repeat, repeat-x which should tile the image horizontally only and repeat-y which should repeat the image vertically only. Background-attachment: fixed is supposed to leave in place while scroll is supposed to gowith the user as they scroll.<br /> Try it - try in both navigator and explorer and with a variety of versions!<br />SPAN is a way to apply a class to a particular set of things - it works! Note also that em stands for the size of the font.</div> <p class="dim"> Here I go with entering information to make multiple lines again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and I hope this is enough!</p><p> Here I go with entering information to make multiple lines again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and I hope this is enough!<span class="bright">This data is going to be brighterthen the rest!</span>Here I go with entering information to make multiple lines again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and I hope this is enough!</p></body></html>

Page 24: CSS in XHTML continued Please use speaker notes for additional information!
Page 25: CSS in XHTML continued Please use speaker notes for additional information!
Page 26: CSS in XHTML continued Please use speaker notes for additional information!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Another CSS Test</title><style type="text/css"> body { background-image: url(CISa.gif); background-position: top left; background-repeat: no-repeat; background-attachment: scroll; background-color: beige; color: green; font-size: 1.5em; font-family: serif; } p { color: blue; font-size: 2em; font-family: sans-serif; } .bright { font-weight: bold; color: red; } .dim { color: brown; }</style></head>

Page 27: CSS in XHTML continued Please use speaker notes for additional information!

<body><div>This is how it is supposed to work! Background-position: has possibilies of top, bottom, center, left and right. Background-repeat: has no-repeat, the default of repeat, repeat-x which should tile the image horizontally only and repeat-y which should repeat the image vertically only. Background-attachment: fixed is supposed to leave in place while scroll is supposed to go with the user as they scroll.<br /> You try it - try in both navigator and explorer - the probelms is frequently older browsers!<br />SPAN is a way to apply a class to a particular set of things - it works! Note also that em stands for the size of the font.<br /><br />This is how it is supposed to work! Background-position: has possibilies of top, bottom, center, left and right. Background-repeat: has no-repeat, the default of repeat, repeat-x which should tile the image horizontally only and repeat-y which should repeat the image vertically only.Background-attachment: fixed is supposed to leave in place while scroll is supposed to gowith the user as they scroll.<br /> You try it - try in both navigator and explorer and with different versions!<br />SPAN is a way to apply a class to a particular set of things - it works! Note also that em stands for the size of the font.</div><p class="dim"> Here I go with entering information to make multiple lines again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and I hope this is enough!</p><p> Here I go with entering information to make multiple lines again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and I hope this is enough!<span class="bright">This data is going to be brighterthen the rest!</span>Here I go with entering information to make multiple lines again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and I hope this is enough!</p></body></html>

Page 28: CSS in XHTML continued Please use speaker notes for additional information!
Page 29: CSS in XHTML continued Please use speaker notes for additional information!
Page 30: CSS in XHTML continued Please use speaker notes for additional information!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Another CSS Test</title><style type="text/css"> body { background-image: url(CISa.gif); background-position: bottom right; background-repeat: no-repeat; background-attachment: fixed; background-color: beige; color: green; font-size: 1.5em; font-family: serif; } p { color: blue; font-size: 2em; font-family: sans-serif; } .bright { font-weight: bold; color: red; } .dim { color: brown; }</style></head>

Page 31: CSS in XHTML continued Please use speaker notes for additional information!
Page 32: CSS in XHTML continued Please use speaker notes for additional information!
Page 33: CSS in XHTML continued Please use speaker notes for additional information!
Page 34: CSS in XHTML continued Please use speaker notes for additional information!
Page 35: CSS in XHTML continued Please use speaker notes for additional information!
Page 36: CSS in XHTML continued Please use speaker notes for additional information!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Positioning - float</title><style type="text/css"> body { background-color: beige; color: green; font-size: 1.2em; } div { background-color: pink; color: navy; font-size: 1.4em; width: 75% } .toright { text-align: right; } .tocenter { text-align: center; color: blue; } .tofloat { float: right; color: maroon; width: 30% } </style></head>

Page 37: CSS in XHTML continued Please use speaker notes for additional information!

<body><p>This is an attempt to do more with positioning. It works better in newer browsers andcan show output that is very difficult to read in some older browsers. Test and be careful!</p><div>This is some data within a division.</div><p>This is some text outside the division. It is in a paragraph which does not have designated style in this page. Notice the division is set up with a width of 75%,so the text-align right within the class will conform to those specifications.</p><div class="toright">This is data aligned using the class set up for that purpose.</div><p>Now I am going to use the text-align right within a paragraph which does not have any styleset for it.</p><p class="toright">This is data in a paragraph that is set up with the text-align right classso it should appear to the right on the screen.</p> <p>Since there are no width constraints onparagraphs it should be all the way to the right. I am getting very carefulabout closing paragraphs when I play with style even if I am in HTML.</p><div class="tocenter">This is centered</div><h1 class="tocenter">This is centered in a header</h1><div>Notice again the affect of 75% width.<br />When dealing with HTML or XHTML, information is usually loaded on the screen in the order it is presented in the HTML file. Absolute positioning impacts this and removes elements from thedefault load flow. Floating can also be used. For example, floating can move things tothe side so that other things will fill in around the floated element.<br /><br /><br /></div><div class="tofloat"> This is an example of text that is set to float.</div><p>Here is some text that we are using to test the floated text described above and this needsto go on and on and on and on and on and on and on and on and on and on and on and on andon and on and on and on and this is get very boring but it still has to go on and on and onand on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on.<br /><br /></p><div class="tofloat"><img src="CISa.gif" alt="CIS" /></div><p>Now we need to put in some more text to watch it flow, so here goes. Here is some text that we are using to test the floated text described above and this needsto go on and on and on and on and on and on and on and on and on and on and on and on andon and on and on and on and this is get very boring but it still has to go on and on and onand on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on

Page 38: CSS in XHTML continued Please use speaker notes for additional information!

<div class="tofloat"> This is an example of text that is set to float.</div><p>Here is some text that we are using to test the floated text discribed above and this needsto go on and on and on and on and on and on and on and on and on and on and on and on andon and on and on and on and this is get very boring but it still has to go on and on and onand on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on.<br /><br /></p><div class="tofloat"><img src="CISa.gif" alt="CIS" /></div><p>Now we need to put in some more text to watch it flow, so here goes. Here is some text that we are using to test the floated text discribed above and this needs

Page 39: CSS in XHTML continued Please use speaker notes for additional information!

and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on on and on and onand on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on on and on and onand on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on.<br /><br /></p><p style="float:right; color: red; ">This is the floating text</p><p>Now we need to put in some more text to watch it flow, so here goes. Here is some text that we are using to test the floated text described above and this needsto go on and on and on and on and on and on and on and on and on and on and on and on andon and on and on and on and this is get very boring but it still has to go on and on and onand on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on on and on and on.

Page 40: CSS in XHTML continued Please use speaker notes for additional information!

<span style="float:left; color:red; padding: .4em; margin: .4em;">This is the floating text.</span>and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on on and on and on. </p>

Page 41: CSS in XHTML continued Please use speaker notes for additional information!

<p><span style="float:right; width: 25%; color:orange; padding: .4em; margin: .4em;">This is the floating text and I am adding enough to make it wrap and then I can see the effects of span.</span>and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on <span style = "clear:right">This will not flow and go onand on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on.</span></p></body></html>