Exercise 5.1 <!DOCTYPE html> <html> <head><title>Chapter 5 - Positioning</title> <style type=\"text/css\"> #box1 { background-color: green; width: 100px; height: 100px; padding: 10px; border: 5px solid black; margin: 20px; } #box2 { background-color: red; width: 50px; height: 50px; padding: 20px; border: 5px dotted black; margin: 10px; } p { } </style></head> <body> <div id=\"box1\"></div> <div id=\"box2\"></div> <p>This is some text added to demonstrate the concept of overlapping.</p> </body></html> Exercise 5.2 <!doctype html> <html> <head><title>Chapter 5 - Floating</title> <style type=\"text/css\"> div { padding: 10px; border: 1px dashed black; margin: 5px; float: left; } #box1 { width: 60px; height: 100px; } #box2 { width: 100px; height: 20px; } #box3 { width: 50px; height: 150px;
height: 150px; } #box4 { width: 20px; height: 50px; } #box5 { width: 150px; height: 120px; } #box6 { width: 120px; height: 70px; } #box7 { width: 25px; height: 80px; } </style></head> <body> <div id=\"box1\">Box 1</div> <div id=\"box2\">Box 2</div> <div id=\"box3\">Box 3</div> <div id=\"box4\">Box 4</div> <div id=\"box5\">Box 5</div> <div id=\"box6\">Box 6</div> <div id=\"box7\">Box 7</div> </body> </html>
Exercise 6.1 <!doctype html> <html> <head><title>Chapter 6 - Display and Visibility</title> <style type=\"text/css\"> #displaydemo { border: 1px dashed black; background-color: yellow; display: inline; width: 100px; height: 100px; } #magic { display: inline; } #magicsentence { color: blue; font-size: 2em; } </style></head> <body> <p>This <span id=\"displaydemo\">yellow box</span> is used to demonstrate the difference between an inline and a block element.</p> <p id=\"magicsentence\">\"This is just like <span id=\"magic\">magic</span>. You can make words disappear.\"</p> </body></html>
Exercise 7.1 <!doctype html> <html> <head><title>Chapter 7 - Background</title> <style type=\"text/css\"> body { background-color: white; background-image: url(\"learncodingfast.png\"); background-repeat: repeat-x; background-attachment: fixed; } #box1 { width: 100px; height: 100px; background-repeat: no-repeat; background-color: blue; background-image: url(\"backgroundposition.png\"); background-position: 0 0; } #box2 { height: 1000px; } </style> </head> <body> <div id=\"box1\"></div> <div id=\"box2\"></div> </body></html>
Exercise 8.1 <!doctype html> <html> <head> <title>Chapter 8 - Font and Text</title> <style type=\"text/css\"> #sampletext{ width: 300px; border: 1px solid black; padding: 20px; font-family: Times, \"Times New Roman\", Georgia, serif; font-size: 1em; font-style: normal; font-weight: normal; color: black; text-align: left; text-decoration: none; letter-spacing: 0px; word-spacing: 0px; line-height: 1; } </style> </head> <body> <h3>Sample Text</h3> <p id=\"sampletext\">This paragraph of text is used to demonstrate the effects of various font and text properties. Modify the CSS declaration for \"sampletext\" and observe what happens to this paragraph of text. A border is given to this paragraph of text in order to show the effect of 'justify'.</p> </body></html>
Exercise 9.1 <!doctype html> <html> <head> <title>Chapter 9 - Lists and Links</title> <style type=\"text/css\"> body { padding-left: 20px; } div { font-weight: bold; text-decoration: underline; font-size: 1.2em; padding- top: 5px;} ol { list-style-type: decimal; } ul { list-style-type: disc; } a { text-decoration: none;} a:link { } a:visited { } a:hover { } a:active { } </style> </head> <body> <div>Styling HTML Lists</div> <p>This section is to demonstrate how you can style ordered and unordered lists in CSS</p> Cars Ordered List <ol> <li>Ford</li> <li>Honda</li> <li>Toyota</li> </ol> Cars Unordered List <ul> <li>Ford</li> <li>Honda</li> <li>Toyota</li> </ul> <hr> <div>Styling Hyperlinks</div> <p>This section is to demonstrate how you can style hyperlinks in CSS</p> <a href=\"somepage.html\">Click Me</a> </body> </html> Exercise 9.2 <!DOCTYPE html> <html> <head><title>Chapter 9 - Navigation Bar</title> <style> ul { list-style-type: none; }
a { display: block; width: 160px; text-align: center; text-decoration: none; background-color: #00FF00; } li { float: left; } </style> </head> <body> <ul> <li><a href=\"home.html\">Home</a></li> <li><a href=\"htmltutorial.html\">HTML Tutorial</a></li> <li><a href=\"csstutorial.html\">CSS Tutorial</a></li> <li><a href=\"javascripttutorial.html\">Javascript Tutorial</a></li> </ul> </body> </html>
Exercise 10.1 <!DOCTYPE html> <html> <head><title>Chapter 10 - Tables</title> <style> div { width: 100%; height: 600px; border: red solid 1px; } table { border: dashed 1px black; } th { border: solid 1px black; } td { border: solid 1px black; } tr { } </style> </head> <body> The table below is a child element of the red box. The red box is added to show the effects of the height and width properties for 'table'.<br><br> <div> <table> <tr><th>Firstname</th><th>Lastname</th><th>Age</th></tr> <tr> <td>Derek</td><td>Lee</td><td>24</td></tr> <tr><td>Aaron</td> <td>Flynn</td><td>16</td></tr> <tr><td>Joe</td><td>Murphy</td> <td>31</td></tr> </table> </div> </body> </html>
Search
Read the Text Version
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108