ruby monstas
play

Ruby Monstas Session 24 Agenda Recap Layout elements HTML 5 - PowerPoint PPT Presentation

Ruby Monstas Session 24 Agenda Recap Layout elements HTML 5 Exercises Recap https://docs.google.com/presentation/d/1rxHrB4wLk7TMMMtIwC9azwNgnYQAFrae620IxjLHygI/edit#slide=id.ge8e058835_0_0 Layout Elements DIV element Text


  1. Ruby Monstas Session 24

  2. Agenda Recap Layout elements HTML 5 Exercises

  3. Recap https://docs.google.com/presentation/d/1rxHrB4wLk7TMMMtIwC9azwNgnYQAFrae620IxjLHygI/edit#slide=id.ge8e058835_0_0

  4. Layout Elements

  5. DIV element Text around<div> Outer DIV element <div>Inner DIV element</div> I will use the whole width of the site. </div>the DIV element This is a so-called block-level element. Because it breaks the flow of the elements into blocks. There are others: <h1>, <p>, <form> and so on

  6. SPAN element This is a <span>S</span>pan elment This is a so-called inline element. Because it flows inline with all other elements. There are others: <a>, <i>, <b>, <strong> and so on

  7. A simple layout example <!DOCTYPE HTML PUBLIC "- //W3C//DTD HTML 4.01//EN" "http://www.w3. org/TR/html4/strict.dtd"> <html> <body> <div class="header"> <h1>Header</h1> </div> <div class="sidebar"> <h2>Sidebar</h2> </div> <div class="content"> <h2>Content</h2> </div> <div class="footer"> <h1>Footer</h1> </div> </body> </html>

  8. … not so simple! (CSS) .header, .footer { “I thought DIVs are block-elements? How come sidebar width: 720px; and content is side by side?” } .sidebar { float: left; this is achieved with the help of the float attribute: this makes height: 50%; the elements “flow” around each other. Just like in a width: 220px; document where text flows around an image. } .content { “You cheat! The width of the page is fixed!” float: left; height: 50%; width: 488px; There is a lot of complexity involved in HTML layout and } resizing, we will cover this in one of the upcoming sessions. .footer { clear: both; }

  9. HTML5 elements

  10. HTML5 Layout elements <!DOCTYPE html> <html> <body> <header> <h1>Header</h1> </header> <nav> <h2>Sidebar (nav)</h2> </nav> <section> <h2>Content (section)</h2> </section> <footer> <h2>Footer</h2> </footer> </body> </html>

  11. … still not simple! (CSS) “WTF. The CSS is even more complicated! What gives!?!” nav, section { True, true! HTML5 elements add context to body, html { float: left; height: 100%; HTML elements. There are multiple advantages height: 50%; } to know the context of an element: } div, header, footer, nav { nav, section { width: 220px; - Google can use it to better ‘judge’ your site border: 1px solid; } - Browsers are able to react (Safari: Reader margin: 0; section { View for example) padding: 5px; width: 488px; } - Screen readers (for the visually impaired) } header, footer { have an easier time navigating the site footer { width: 720px; clear: both; } } Besides that they are ‘simple’ DIVs

  12. HTML5: other elements An article with a title and text Embed audio & video <article> <h2>Article title</h2> <audio controls> <source src="foo.mp3" type="audio/mpeg"> <p>Article text</p> <source src="foo.ogg" type="audio/ogg"> </article> No support for audio </audio> <video controls> Main content <source src="foo.mp3" type="video/mpeg"> <source src="foo.ogg" type="video/ogg"> <main> No support for video <article> </video> ... </article> <article> ... </article> </main>

  13. Your feedback, please? http://goo.gl/forms/rUrZqOPNq6 (Session 23)

  14. Time to practice

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend