www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: How to properly use HTML5 section tag

  1. #1
    Join Date
    May 2012
    Posts
    79

    How to properly use HTML5 section tag

    I was informed that I am using HTML5's section tag incorrectly. Can anyone show me the proper way to use HTML5's section tag?

    Code:
        <div id="content-container">
         <div id="form">
      	 <p>
    	  <label class="block">
    	     <input type="text" id="zip" class="normal" type="zip" autocomplete="on" value="zip code">
    	  </label> 
    	  <button type="submit"  id="submit" value="CHECK NOW" title="check now">check now</button>
      	</p>		
        </div><!-- end form -->
    	  	
      	<img width="959" height="330" alt="clear form" src="img/widthHero.png"/>
      		  		  		 
       <div id="content">
      		
       <section id="noInstall">
      	<a href="#"><img src="img/noInstall.png" alt="No Installation Appointments" title="No Installation Appointments" /></a>
       </section>
      			
      <section id="affordable">
      	<a href="#"><img src="img/affordablePlan.png" alt="Affordable Plans" title="Affordable Plans" /></a>
      </section>
      			
      <section id="tomorrow">
      	<a href="#"><img src="img/onlineTomorrow.png" alt="Get Online By Tomorrow" title="Get Online By Tomorrow" /></a>
      </section>
      			
      <section id="take-w-you">
      	<a href="#"><img src="img/takeInternet.png" alt="Take It With You Internet" title="Take It With You Internet" /></a>
      </section>
      			
      <section id="coverage">
      	<a href="#"><img src="img/cwCoverage.png" alt="City Wide Coverage" title="CityWide Coverage" /></a>
      </section>			
     </div><!-- end content-->

  2. #2
    Join Date
    Aug 2012
    Posts
    155
    From what I have been reading recently, don't use section, article or aside, they are pointless and you are better just sticking to divs.

  3. #3
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,207
    When to Use the HTML5 “section” Element

    When to Use the HTML5 SECTION Element

    The section element

    Those might help. The section tag is not to be used the same as a div tag. The SECTION Element is a Semantic Element.

  4. #4
    Join Date
    Aug 2012
    Posts
    155
    And it doesn't even have any point as a SEMANTIC ELEMENT at the moment!!! Better off using Aria Roles

  5. #5
    Join Date
    May 2012
    Posts
    79
    I appreciate your feedback. It's really frustrating because some articles i've read say "take advantage of the new HTML5 tags" while others say HTML5 elements such as the section tag "don't have a specific use/ purpose so it should be avoided". W3C.org is very vague (imo). I was viewing one article that stated section tags are to be used as a replacement for div tags, however after viewing this article http://html5doctor.com/avoiding-common-html5-mistakes/ it states use section tags as a wrapper is bad coding practice... What is the purpose of introducing section tag if there is no purpose for it? The role attribute was introduced in XHTML but was later omitted however with HTML5 it has been re-introduced. How should the role attribute be properly used?

  6. #6
    Join Date
    Aug 2012
    Posts
    155
    I wish I could help you further but I am really in the same position as you - I initially read all about the HTML5 tags and started using them, only to now read (at the same sources as you have been reading really) that they don't really do anything and also shouldn't be used for styling, so in affect, completely pointless.

    What really clarified this for me is that I have started reading a book - The Truth About HTML5 (For Web Designers) by Luke Stevens and it makes sense how he explains it all (I haven't finished the book yet but so far so good).

    The point of the AIRA Roles is for screen readers / visually impaired, which makes a lot more sense to me.

  7. #7
    Join Date
    May 2012
    Posts
    79
    Thank You!!!! I have been looking for a good book on HTML5. I will be creating a new post for this question but wanted your feedback, what tools are you currentlyusing for cross-browser compatibility testing? I was using ie tester but that proved to be unreliable, since I have started using IE's developer tool which is somewhat similar to Chrome's developer tool (but not as good imo).

  8. #8
    Join Date
    Aug 2012
    Posts
    155
    I usually use Browserlab by Adobe for cross-browser testing but that is not always accurate either and then sometimes free online testers (can't remember site names off the top of my head, sorry).

  9. #9
    Join Date
    Sep 2008
    Location
    Dallas
    Posts
    154
    No point in having a section just to house a link. It would make more sense to have a <section> that housed all your links. Also, each section can have a <header> and <footer>. HTML5 <header>s and <footer>s aren't how developers would normally view a header and footer. But as other posters have said, there is no SEO advantage to using new HTML5 tags. You're better off with <div>s that have classes and ids.

  10. #10
    Join Date
    Oct 2012
    Location
    Bengough, SK, Canada
    Posts
    4

    Lightbulb How I use the section tags!

    In your code example it looked like something i had setup a few days ago. I don't use <div> anymore in my projects and have moved up to getting standard with HTML5. After your form ends you could just use a list to pump out those links and just slap the list into a <section>. You just had the section too far down the hierarchy. You could do it like this.

    Code:
    <section id="pwrap">
    
    
    <section id="formCheck"> <form> Zip Code: <input type="text" name="fname"><br> <input type="submit" value="Check Now"> </form> </section> <section id="content"> <ul> <li id="noInstall"><a href="#">(image)</a></li> <li id="yesInstall"><a href="#">(image)</a></li> </ul> </section>
    </section>
    When you use HTML5 tags it for the most part makes your markup easy to understand and makes more sense. I'm assuming you id'd your sections for another reason? If you need any further help with HTML5 tags just get a hold of me, I am a big supporter.

  11. #11
    Join Date
    Sep 2008
    Location
    Dallas
    Posts
    154
    That's a perfectly illustrated misuse of <section>. HTML5 is in its infant stages. It's not a final product yet. Windows XP will be around for several more years, and the most they can ever upgrade to is IE8. There is no IE9 for XP, and there never will be. Using HTML5 in older legacy IE browsers will cause the site to break. You get no SEO benefits to using HTML5. It's redundant. Just learn HTML and use classes and advanced CSS selectors.

  12. #12
    Join Date
    Oct 2012
    Location
    Bengough, SK, Canada
    Posts
    4
    It works, it's clean and it's up to date. If you want to design backwards for those who stand still then that is certainly one approach. Just be careful you don't get left behind :P

  13. #13
    Join Date
    Sep 2008
    Location
    Dallas
    Posts
    154
    It works. It's not clean, and it's not semantically correct. By your standards, let's eliminate 50% of computer users in the world. I'm not sure what companies you've developed for, all all the ones I do have a source of commerce - usually via the web. So those who are (and I completely f'ing agree) 'standing still' are also potential customers/clients and dictate (unfortunately) how the web advances, because they are stuck on IE. Newer isn't always better, and HTML5 is a perfect example. You have yet to articulate one positive thing about HTML5 and how <section>s are better than <div>s, and I just gave you a huge reason why they're not. And what you call "designing backwards" is what pros call graceful degradation. You should get over your pride, and see what real developers are actually doing. When HTML5 finishes out and is a final product, it's nothing to learn a few new tags. Until then, you have to go with what works on new and older technology, and if you're busy wasting time on <section> tags, you're missing the point.

  14. #14
    Join Date
    Oct 2012
    Location
    Bengough, SK, Canada
    Posts
    4
    HTML5 can be read by legacy browsers anyway with a simple shiv or modernizers. There are games based on HTML5, storage is smarter, media support is great, list goes on! HTML5 isn't the future, it is here right now. I have yet to come across a reason why I wouldn't want to use HTML5. You can even get rid of flash and even silverlight (crap anyway). Apple is pushing it and it is great for modern mobile devices. It has nothing to do with pride, for me it just makes the most sense is all.

  15. #15
    Join Date
    Sep 2008
    Location
    Dallas
    Posts
    154
    No, I agree. It's great. It has many benefits, but regarding this topic, <section>s aren't one of them. They are useless. Also, modernizer doesn't fix everything.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles