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

Intro to HTML

Intro to HTML

A brief introduction to the basic structure of an HTML document, and explanation of when to use certain elements in content management.

Avatar for Ash Robbins

Ash Robbins

March 05, 2013
Tweet

Other Decks in Technology

Transcript

  1. Tags & Elements A pair of tags and everything between

    them make up an element <p>Some content</p>
  2. Nesting Always close the most recently opened tag first. Close

    them in the opposite order you opened them. <p> <h1>Some text</h1> <em>Some more text</em> Even more text. </p> Good <p> <h1>Some text <em>Some more text</h1> Even more text.</em> </p> Bad
  3. Basic HTML Page <!DOCTYPE html> <html> <head> <title>My page</title> </head>

    <body> <h1>A heading</h1> <p>Any old content</p> </body> </html>
  4. Basic HTML Page <!DOCTYPE html> <html> <head> <title>My page</title> </head>

    <body> <h1>A heading</h1> <p>Any old content</p> </body> </html> Doctype Tells the browser which version of HTML we are using. In this case, we tell the browser HTML5 is being used.
  5. Basic HTML Page <!DOCTYPE html> <html> <head> <title>My page</title> </head>

    <body> <h1>A heading</h1> <p>Any old content</p> </body> </html> HTML element The HTML element, or ‘root’ element. Defines the beginning and end of an HTML document.
  6. Basic HTML Page <!DOCTYPE html> <html> <head> <title>My page</title> </head>

    <body> <h1>A heading</h1> <p>Any old content</p> </body> </html> head element The head element contains metadata about the document. For example the title of the page, links to scripts and links to stylesheets.
  7. Basic HTML Page <!DOCTYPE html> <html> <head> <title>My page</title> </head>

    <body> <h1>A heading</h1> <p>Any old content</p> </body> </html> title element The title element define the title of the document. This is what will be shown in the browser’s title bar.
  8. Basic HTML Page <!DOCTYPE html> <html> <head> <title>My page</title> </head>

    <body> <h1>A heading</h1> <p>Any old content</p> </body> </html> body element The body element holds the main content of the page. All content that will be shown on the web is contained in here.
  9. Formatting Content <h1>, <h2>, <h3>, <h4>, <h5>, <h6> Header elements

    are used to describe a section of content, and the numbers indicate importance. <h1>Most important</h1> ... <h6>Least important</h6> Headings are not meant to be used to simply re-size a portion of text.
  10. Formatting Content <b> The <b> element is used to display

    a portion of text differently – normally in bold type – but doesn’t convey any meaning. For example you could use it to highlight the key word in a sentence: These slides talk about how to create <b>HTML</b> content. These slides talk about how to create HTML content.
  11. Formatting Content <strong> The <strong> element is different to the

    <b> element , as it is intended to give importance to text, as well as display in bolder type. This is a <strong>very dangerous</strong> activity. This is a very dangerous activity.
  12. Formatting Content <em> This element is used to change the

    emphasis of a passage of text. Browsers usually display emphasised text in italics. Someone call a doctor, <em>now</em>! Someone call a doctor, now!
  13. Formatting Content <code> It may sometimes be necessary to display

    a piece of text in the style of code. We need to use an <code><h1></code> tag there, it needs more importance. We need to use an <h1> tag there, it needs more importance.
  14. Links <a> To create a hyperlink, wrap some content in

    an <a> tag. The destination of the link is set using the href attribute. The title attribute is used Follow us on <a href=“http://twitter.com”>Twitter</a> Follow us on Twitter.
  15. Links <a> You can also link to an anchor within

    the same document, by prefixing the anchor name with a hash (#). Find our <a href=“#contact”>contact</a> details at the bottom of the page. Find our contact details at the bottom of the page.
  16. Images <img> To add an image to a page you

    use the <img> tag. There are two required attributes; src which specifies the path to the image, and alt, which allows you to set some alternate text to be displayed if the image can’t be found. <img src=“/path/to/your/image.jpg” alt=“My picture” /> The <img> element is self-closing, in other words it doesn’t require a clsoing tag.
  17. Paragraphs <p> The <p> element defines a paragraph of text.

    <p>This is paragraph one.</p> <p>This is paragraph two.</p> This is paragraph one. This is paragraph two.
  18. Bulleted (Unordered) Lists <ul> The unordered list is used to

    display a collection of items that don’t need numerical ordering. They are typically displayed with bullets. <ul> <li>Cheese</li> <li>Bread</li> <li>Milk</li> </ul> • Cheese • Bread • Milk
  19. Numbered (Ordered) Lists <ol> The ordered list is used to

    display a collection of items in numerical order. They are typically displayed with numbers or letters. <ol> <li>First</li> <li>Second</li> <li>Third</li> </ol> 1. First 2. Second 3. Third
  20. Quotes <blockquote> This element represents a section of content that

    is quoted from another source. If this is a web address, the cite attribute can be used to reference the source. <blockquote cite=“http://website.com”> <p>This paragraph is a quotation from another source.</p> </blockquote> The way this displays is dependent on your stylesheet, but typically the paragraph would be indented.
  21. Tables <table> Used to display data in tables. Not meant

    for layout. <table> <tr> <th>Firstname</th> <th>Surname</th> </tr> <tr> <td>John</td> <td>Smith</td> </tr> <tr> <td>Joan</td> <td>Smythe</td> </tr> </table> Firstname Surname John Smith Joan Smythe