Crenox

Web Development Tutorial for Beginners LearnCode.academy #2

Jun 23rd, 2015
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Home</title>
  5. <link href="styles/main.css" rel="stylesheet" type="text/css" />
  6. </head>
  7. <body>
  8. <h1>My Website</h1>
  9. <ul>
  10. <li>Home</li>
  11. <!-- relative links: links that are in the same folder as the one you're in -->
  12. <li><a href="page2.html">Page 2</a></li>
  13. <li><a href="page3.html">Page 3</a></li>
  14. </ul>
  15. <h2>This is my homepage</h2>
  16. <p>And all of my homepage content</p>
  17. </body>
  18. </html>
  19. -------------------------------------------------------------------------------------------------------------------------------
  20. <!DOCTYPE html>
  21. <html>
  22. <head>
  23. <title>Page 2</title>
  24. <link href="styles/main.css" rel="stylesheet" type="text/css" />
  25. </head>
  26.  
  27. <body>
  28. <ul id="nav">
  29. <li><a href="index.html">Home</a></li>
  30. <li>Page 2</li>
  31. <li><a href="page3.html">Page 3</a></li>
  32. </ul>
  33. <h2>This is Page 2</h2>
  34. <p>And all of my Page 2 content</p>
  35. <p class="secondary">And all of my Page 2 content</p>
  36. <p>And all of my Page 2 content</p>
  37. </body>
  38. </html>
  39.  
  40. <!-- The difference between id and class is that with id, you can only have one of it per page
  41. while with class, you can have the same class for multiple elements in a page -->
  42. -----------------------------------------------------------------------------------------------------------------------------
  43. <!DOCTYPE html>
  44. <html>
  45. <head>
  46. <title>Page 3</title>
  47. <link href="styles/main.css" rel="stylesheet" type="text/css" />
  48. </head>
  49.  
  50. <body>
  51. <ul>
  52. <li><a href="index.html">Home</a></li>
  53. <li><a href="page2.html">Page 2</a></li>
  54. <li>Page 3</li>
  55. </ul>
  56. <h2>This is Page 3</h2>
  57. <p>And all of my Page 3 content</p>
  58. </body>
  59. </html>
  60. -----------------------------------------------------------------------------------------------------------------------------
  61. /* selector: what you wanna style */
  62. body
  63. {
  64. /* rules: styles for the selector */
  65. background: #999;
  66. font-family: arial;
  67. }
  68.  
  69. h1, h2, li
  70. {
  71. color: #555;
  72. }
  73.  
  74. a
  75. {
  76. color: green;
  77. }
  78.  
  79. p
  80. {
  81. background: #666;
  82. color: white;
  83. /* it pads (definition of space between the element border and element content) all sides of whatever element your styling */
  84. /* you can just have one number */
  85. /* you can also have tow numbers, top bottom is the first number and left right is the second number */
  86. /* you can also do 4 numbers, and it would go clockwise: top, right, bottom, left */
  87. padding: 10px;
  88. }
  89.  
  90. /* "." are class */
  91. .secondary
  92. {
  93. background: none;
  94. color: #777
  95. }
  96.  
  97. /* "#" are id */
  98. #nav
  99. {
  100. background: red;
  101. color: white;
  102. }
  103.  
  104. /* you can override styles by putting the same element to style under it, and whatever's lower
  105. will be shown */
Add Comment
Please, Sign In to add comment