Documente Academic
Documente Profesional
Documente Cultură
Code to type in
<!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>
Now include the following lines of code before the </body> tag
<h1>This is a heading</h1> <h2>This is a heading</h2> <h3>This is a heading</h3>
<p>This is a paragraph.</p> <p>This is another paragraph.</p> <a href="http://www.w3schools.com">This is a link</a> <img src="w3schools.jpg" width="104" height="142" />
Lesson 3 Using Colours <!DOCTYPE html> <html> <body style="background-color:yellow;"> <h2 style="background-color:red;">This is a heading</h2> <p style="background-color:green;">This is a paragraph.</p> </body> </html> Lesson 4 using fonts <!DOCTYPE html> <html> <body> <h1 style="font-family:verdana;">A heading</h1> <p style="font-family:arial;color:red;font-size:20px;">A paragraph.</p> </body> </html> Lesson 5 Inline style sheets <head> <style type="text/css"> body {background-color:yellow;} p {color:blue;} </style> </head>
Lesson 6 Inserting and formatting an image to do this one you will need to save the image in the folder called pulpit.jpg into the same folder as where you save the web page <!DOCTYPE html> <html> <body> <h2>Norwegian Mountain Trip</h2> <img border="0" src="/images/pulpit.jpg" alt="Pulpit rock" width="304" height="228" /> </body> </html> Lesson 7 - tables <table border="1"> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </tr> </table> Lesson 8 more tables with borders <table border="1"> <tr> <th>Header 1</th> <th>Header 2</th> </tr> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </tr> </table>
Lesson 9 unordered list <!DOCTYPE html> <html> <body> <h4>An Unordered List:</h4> <ul> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul> </body> </html> Lesson 10 An ordered list <!DOCTYPE html> <html> <body> <h4>An Ordered List:</h4> <ol> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ol> </body> </html>
Lesson 11 Using Java script <!DOCTYPE html> <html> <head> <script> function displayDate() { document.getElementById("demo").innerHTML=Date(); } </script> </head> <body> <h1>My First JavaScript</h1> <p id="demo">This is a paragraph.</p> <button type="button" onclick="displayDate()">Display Date</button> </body> </html> Lesson 12 More Java Script <!DOCTYPE html> <html> <body> <h1>My First Web Page</h1> <p>My First Paragraph.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { document.write("Oops! The document disappeared!"); } </script> </body> </html>
Lesson 13 Java script in the Header <!DOCTYPE html> <html> <head> <script> function myFunction() { document.getElementById("demo").innerHTML="My First JavaScript Function"; } </script> </head> <body> <h1>My Web Page</h1> <p id="demo">A Paragraph.</p> <button type="button" onclick="myFunction()">Try it</button> </body> </html> Lesson 14 Doing calculations using Java script. <!DOCTYPE html> <html> <body> <p>Given that y=5, calculate x=y+2, and display the result.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var y=5; var x=y+2; var demoP=document.getElementById("demo") demoP.innerHTML="x=" + x; } </script> </body> </html>