Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A beginner's guide to HTML & CSS

A beginner's guide to HTML & CSS

A beginner's guide to HTML & CSS is a set of slides put together for marketing students for the Startup Institute New York City session.

CollinsAx

March 10, 2014
Tweet

More Decks by CollinsAx

Other Decks in Programming

Transcript

  1. Part 1: • Project files and folders • HTML Tags

    and the semantic web • Javascript • CSS
  2. <h1>...<h6> <p> <a> <strong> <em> <span> <img> <video> <audio> Common

    HTML Tags <html> <head> <body> <div> <section> <header> <footer> <nav> <article> <aside> <ul> <ol> <li> <form> <input> <button> <table> <th> <tr> <td>
  3. Block Their most significant characteristic is that they typically are

    formatted with a line break before and after the element (thereby creating a stand- alone block of content). That is, they take up the width of their containers. Example: div, h1, p • https://developer.mozilla.org/en- US/docs/HTML/Block-level_elements Inline Inline elements can appear within block-level or other inline elements. They take up the width of their contents. Example: span, strong, img • https://developer.mozilla.org/en- US/docs/HTML/Inline_elements
  4. Doctype, head & body <!DOCTYPE html> <html> <head> <title>My new

    website</title> </head> <body> <article> <h1>This is a title</h1> <p>Paragraph <strong>text</strong> . . . </p> </article> </body> </html>
  5. Commenting code <p>This is a paragraph.< /p > <!-- This

    is a comment --> <p>This is a paragraph.< /p >
  6. The Semantic Web "The Semantic Web is an extension of

    the current web in which information is given well-defined meaning, better enabling computers and people to work in cooperation." Scientific America, "The Semantic Web" Berners-Lee et al. May 2001,
  7. JS Libraries & scripts <script src=”javascripts/jquery-1.9.1.min.js” type=”text/javascript”></script> <script src='javascripts/main.js' type='text/javascript'></script>

    Inline scripts <script>document.getElementById("myDIV").innerHTML="How are you?";</script> Plugins (Analytic Codes) <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXXX-XX', yourwebsite.com'); ga('send', 'pageview'); </script>
  8. Link to Stylesheet <!DOCTYPE html> <html> <head> <title>My new website</title>

    <link href='style.css' rel='stylesheet' type='text/css'> </head> <body> <article> <h1>This is a title</h1> <p>Paragraph <strong>text</strong> . . . </p> </article> </body> </html>
  9. <p id=”par34” class=”awesome”>This is a paragraph.< /p > p{ background-color:

    black; } .awesome{ margin: 25px; } #par34{ color: white; } p#par34.awesome{ border: 5px solid #ff0000; color: #f00; }
  10. Content Box (browser default) .box{ background-color: red; border: 10px solid

    blue; box-sizing: content-box; height: 50px; margin: 30px; padding: 15px; width: 50px; } 50 15 10 30 160px 30 10 15
  11. Border Box .box{ background-color: red; border: 10px solid blue; box-sizing:

    border-box; height: 50px; margin: 30px; padding: 15px; width: 50px; } 0 15 10 30 110px 30 10 15
  12. Float With CSS float, an element can be pushed to

    the left or right, allowing other elements to wrap around it. Just to make sure to Clear it. .box{ height: 100px; float: left; margin: 0 10px 10px 0; width: 100px; } .nextSection{ clear: left; }
  13. .box{ background-color: orange; top: 100px; left: 20px; height: 50px; margin-bottom:

    20px; } Static A static positioned element is always positioned according to the normal flow of the page.
  14. Relative A relative positioned element is positioned relative to its

    normal position. .box{ background-color: orange; top: 100px; left: 20px; height: 50px; margin-bottom: 20px; }
  15. Absolute An absolute position element is positioned relative to the

    first parent element that has a position other than static. .box{ background-color: orange; top: 100px; left: 20px; height: 50px; margin-bottom: 20px; width: 100%; }
  16. Fixed An element with fixed position is positioned relative to

    the browser window. It will not move even if the window is scrolled. .box{ background-color: orange; top: 100px; left: 20px; height: 50px; margin-bottom: 20px; width: 100%; }
  17. padding right top visibility width z-index letter-spacing line-height text-align text-decoration

    Common CSS Properties background border bottom clear display float height left overflow padding text-shadow font border-collapse border-spacing list-style animation transform transition box-sizing cursor
  18. Value syntax .box{ background: transparent url(“../images/image.jpg”) no-repeat 10px 10px; box-shadow:

    7px 7px 5px 0px rgba(50, 50, 50, 0.5); color: #000; height: 50px; margin: 10px 20px 5px 15px; padding: 10px; width: 100%; z-index: 5; }
  19. • Web inspectors • Firebug • Colorzilla • MeasureIt •

    Virtual Machines • Emulators/Simulators
  20. You WILL break • Back up code • Track changes

    (github) • Ask questions • Testing environments stuff