Don't like ads? PRO users don't see any ads ;-)
Guest

Return

By: a guest on Aug 10th, 2012  |  syntax: HTML  |  size: 1.42 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <!DOCTYPE html>
  2. <html>
  3. <body style="background-color:black">
  4.  
  5. <h1 style="color:white;font:arial;font-size:40px;">Alex Franklin is a <big> beast</big></h1>
  6.  
  7. <p style="color:white;font:verdana;font-size:15px;"> tom will love this<br /> Do you like it? </p>
  8.  
  9. <!--
  10. You used HTML5 document type declaration at the top (good)
  11. You need to use double quotes around values of attributes (e.g style="")
  12. Closing tags such as <br /> should be enclosed like so, not like this: <br>
  13.  
  14. And you've used inline styling. This is not bad at the moment because we're just starting out, but later on you will want to create a .css file to store them styles in (the inline styles is CSS, so you're doing two languages in one page at the moment!)
  15.  
  16. Here's how you can segregate your HTML code from your CSS styling:
  17. <!DOCTYPE html>
  18. <html>
  19. <head>
  20. <style type="text/css">
  21. body /*affects the <body> tag only*/
  22. {
  23.    background-color: black;
  24. }
  25. h1.property /*the "property" class only affects <h1> tags with "property" as their class value*/
  26. {
  27.    color:white;
  28.    font:arial;
  29.    font-size:40px;
  30. }
  31. p#property /*the "property" ID only affects <p> tags with "property" as their ID value*/
  32. {
  33.    color:white;
  34.    font:verdana;
  35.    font-size:15px;
  36. }
  37. </style>
  38. </head>
  39. <body>
  40.  
  41. <h1 class="property">Alex Franklin is a <big> beast</big></h1>
  42.  
  43. <p id="property">Tom will love this<br />Do you like it?</p>
  44.  
  45. </body>
  46. </html>
  47. -->
  48. </body>
  49. </html>