530 likes | 640 Views
HTML: a step further. Chris Limb. So where were we?. <html>. <head>. <title>. My Web Page. </title>. </head>. <body background= " texture1.jpg " >. My Web Page. </h1>. <h1>. <img src= " image1.jpg" align="left" alt=“cat">. <p>.
E N D
HTML:a step further Chris Limb
So where were we? <html> <head> <title> My Web Page </title> </head> <body background="texture1.jpg"> My Web Page </h1> <h1> <img src="image1.jpg" align="left" alt=“cat"> <p> Welcome to my Web Page which contains all sorts of useless information about me. </p> <br clear="left"> My Top 3 Cats </h2> <h2> <ol> Black Shorthair </li> </b> <li> <b> </i> Silver Tabby </li> <li> <i> </li> <li> Scottish Wildcat </ol> Useful Links </h2> <h2> <ul> </a> <li> <a href="http://www.catoftheday.com"> Cats! </li> <a href="details.html"> My Details </a> </li> <li> </ul> </body> </html>
<html> <head> <title> My Web Page </title> </head> <body background="texture1.jpg"> My Web Page </h1> <h1> <img src="image1.jpg" align="left" alt="me"> <p> Welcome to my Web Page which contains all sorts of useless information about me. </p> <br clear="left"> My Top 3 Cats </h2> <h2> <ol> Black Shorthair </li> </b> <li> <b> </i> Silver Tabby </li> <li> <i> </li> <li> Scottish Wildcat </ol> Useful Links </h2> <h2> <ul> </a> <li> <a href="http://www.catoftheday.com"> Cats! </li> <a href="details.html"> My Details </a> </li> <li> </ul> </body> </html> Which looks like...
Tools you will be using... • Internet Explorer: To view your files... • PFE (or Notepad): To edit your files...
Finding PFE (or Notepad) • ÿStart >Programs > Utilities >Text Editor (PFE) • ÿStart >Programs > Accessories >Notepad
Practical 1 Using PFE, open the file template.html from your disk, and save immediately as index.html. Create a simple web page in index.html containing a couple of headings, paragraphs, lists, images and a link to the University of Sussex home page. You will find image files on the floppy disk entitled image05.jpg, image06.jpg etc Save the file and view it in Internet Explorer
Web Page About Nothing - Netscape This is a paragraph about nothing. A centred paragraph about nothing. A right aligned paragraph about nothing. Lines and Divisions <p> This is a paragraph about nothing. </p> <hr> align= > <div "center" <p> A centred paragraph about nothing. </p> </div> align= > <div "right" <p> A right aligned paragraph about nothing. </p> </div>
Web Page About Nothing - Microsoft Internet Explorer This is some text in an HTML document Colour (or "Color") <body bgcolor= "#ff0000" > <body text= "#0000ff" > <body bgcolor= "#ff0000" text= "#0000ff" >
Colour codes #0000ff RED GREEN BLUE
Colour codes #ff0000 RED GREEN BLUE
Colour codes #00ff00 RED GREEN BLUE
Colour codes #ffff00 RED GREEN BLUE
Colour codes #cccccc RED GREEN BLUE
Colour codes #000000 black cyan #00ffff magenta #ff00ff #ffd700 gold white #ffffff not coffee at all #c0ffee
Counting in Hex Now imagine you had sixteen fingers... 4 d 3 5 e c 6 b 2 f a 7 8 9 10 1
Counting in Hex Still imagining you have sixteen fingers, count to 100... 3 4 5 6 7 8 9 a b c d e f 0 1 2 12 ... 10 11 ... f9 fa fb fc fd fe ff 256 values represented using only 2 characters
Practical 2 Open index.html in PFE and add some formatting using colour, horizontal lines and divisions
Introducing the table the table contains table rows the table rows contain table cells
Sounds familiar? <table> <td> </td> <tr> <td> </td> </tr> <td> </td> <tr> <td> </td> </tr> </table>
HTML table <table border="1"> <tr> <td>First Cell</td> <td>Second Cell</td> </tr> <tr> <td>Third Cell</td> <td>Fourth Cell</td> </tr> </table>
Table Attributes cellpadding&cellspacing space between the cells padded cell
Practical 3 Open template.html in PFE and save it as table.html. Write the code to include a table that it looks something like this:
Use of tables Originally designed for tabular data:
Use of tables Now more often used for layout:
Use of tables Have a closer look:
More complex tables colspan&rowspan
Using colspan <table border="1"> <tr> <td colspan="2">First Cell</td> </tr> <td>Cell 3</td> <td>Cell 2</td> <tr> </tr> </table>
Using rowspan <table border="1"> <td rowspan="2"> First Cell</td> <tr> </tr> <td>Cell 2</td> <tr> </tr> <td>Cell 3</td> </table>
Practical 4 Open template.html in PFE and save it as table2.html. Write the code to include a table that it looks something like this: Experiment with some other page layouts - e.g. using tables of fixed width.
Why can't we change the font? The colour? <p> <font face="Arial,Helvetica,sans-serif" color="#ff0000"> My Web Page </font> uses different fonts and colours </p>
Seems easy enough... <p>Twas <a href="brillig.html"> <font face="Arial,Helvetica, sans-serif" size="+1" color="#FF0000">brillig</font></a>, and the slithy toves<br>Did gyre and <a href="gimble.html"> <font face="Arial,Helvetica,sans-serif" size="+1" color="#FF0000">gimble</font></a> in the wabe:<br>All <a href="mimsy.html"> <font face="Arial,Helvetica,sans-serif" size="+1" color="#FF0000">mimsy</font></a> were the <a href="borogoves.html"> <font face="Arial,Helvetica,sans-serif" size="+1" color="#FF0000">borogoves</font></a>, <br>And the mome raths <a href="outgrabe.html"> <font face="Arial,Helvetica,sans-serif" size="+1" color="#FF0000">outgrabe</font></a>.</p>
Put some style in your head <head> <title>Metaphorazine</title> <style> a {color : Red; font-family : Arial, Helvetica, sans-serif; font-size : large;} </style> </head> <body> <p>Johnny takes <a href="meta.html">Metaphorazine</a>. Every clockwork day.<br> Says it <a href="burns.html">burns</a> his house down, with a haircut made of wings.<br> You could say he eats a <a href="problem.html">problem.</a><br> You could say he stokes his thrill.<br> Every <a href="clingfilm.html">clingfilm</a> evening, climb inside a little pill.<br> Intoxicate the feelings. Play those <a href="skullpiano.html"> skull-piano</a> blues.<br> <a href="johnny.html">Johnny</a> takes Metaphorazine. He's a dog.</p>
Put some style in your head <head> <title>Metaphorazine</title> <style> a {color : Red; font-family : Arial, Helvetica, sans-serif; font-size : large;} </style> </head> <body> <p>Johnny takes <a href="meta.html">Metaphorazine</a>. Every clockwork day.<br> Says it <a href="burns.html">burns</a> his house down, with a haircut made of wings.<br> You could say he eats a <a href="problem.html">problem.</a><br> You could say he stokes his thrill.<br> Every <a href="clingfilm.html">clingfilm</a> evening, climb inside a little pill.<br> Intoxicate the feelings. Play those <a href="skullpiano.html"> skull-piano</a> blues.<br> <a href="johnny.html">Johnny</a> takes Metaphorazine. He's a dog.</p>
Put some style in your head <style> a {color : Red; font-family : Arial, Helvetica, sans-serif; font-size : large;} h1 {color : Blue; font-family : Verdana, Arial, Helvetica, sans-serif;} h2 {color : Green; font-family : Verdana, Arial, Helvetica, sans-serif;} p {color : Black; font-family : Arial, Helvetica, sans-serif;} </style>
Practical 5 Try to add formatting to some of your pages by adding <style> tags to the head. There's a reference of style sheet commands in your handouts.
More stylish shortcuts <style> a {color : Red; font-family : Arial, Helvetica, sans-serif; font-size : large;} h1, h2, h3, h4 {color : Blue; font-family : Verdana, Arial, Helvetica, sans-serif;} p, ul, ol, li {color : Black; font-family : Arial, Helvetica, sans-serif;} </style>
Classes <style> p.normal {color : Black; font-family : Arial, Helvetica, sans-serif;} p.strange {color : Red; font-family : Verdana, Arial, Helvetica, sans-serif; font-size : x-large;} </style> ... <p class="normal">We are normal...</p> <p class="strange">...and we want our freedom!</p>
Pseudo-classes <style> a:link { color : Blue; font-family : Arial, Helvetica, sans-serif;} a:visited { color : Purple; font-family : Arial, Helvetica, sans-serif;} a:hover { color : Red; font-family : Arial, Helvetica, sans-serif; text-decoration : none;} </style> ... <a href="metaphorazine.html">Metaphorazine</a>