These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:10 pm Advanced search

h1 element should only be allowed once

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

Postby BlueBoden » Wed Feb 09, 2011 10:06 pm

Screen readers do read the headings. while i don't think they don't care if its a h1 or a h2, we as authors generally should.

Implying that a navigation column is part of the main article, would be semantically incorrect. Its a independent section of the page. An example of as to where it would be considered "correct" to have multiple h1s.
The nav element deals with this in a cleaner fashion.

You are thinking as if a website was a newspaper, and seem to overlook the fact that a website is much more sophisticated.

The old way of dealing with structural sectioning, would call for the need to use multiple h1's. The new way is to use the sectioning elements, in which case the numbering of the headers would be ignored, given that the (sectioning elements are used).

Only parts such as a "table of contents" list could be considered part of the main article, and as such be indicated by h2, or perhaps an aside element.
User avatar
BlueBoden
<h4>
 
Posts: 26
Joined: Wed Feb 09, 2011 4:40 am

Postby Xdega » Thu Mar 03, 2011 2:45 pm

granor wrote:Using h1 like title is nonsensical. why would we need 2 elements that do the same thing?

^^ this.

I would much rather the content of the page be described in the headers <head> than in the body of the page. The <h1>through <h6> should be used at the designers discretion.

Code: Select all
<html>
   <body>
      <section>
         <h1></h1>
         <p></p>
         <h2></h2>
         <p></p>
         <h3></h3>
         <p></p>
      </section>
   </body>
</html>


should be valid. As should:

Code: Select all
<html>
   <body>
      <section>
         <h1></h1>
         <p></p>
      </section>
      <section>
         <h2></h2>
         <p></p>
      </section>
      <section>
         <h3></h3>
         <p></p>
      </section>
   </body>
</html>


I also think that for documents that are not that rich in content that they require multiple uniquely styled headers, the <h1> tag should just be used for simplicity:

Code: Select all
<html>
   <body>
      <section>
         <h1></h1>
         <p></p>
      </section>
                <section>
         <h1></h1>
         <p></p>
      </section>
                <section>
         <h1></h1>
         <p></p>
      </section>
   </body>
</html>


Don't take away that freedom. It's like locking everyone up in prison, because a few people commit crimes.

As I mentioned. Search engines, screen readers etc should focus on the documents headers <head> for content type and description.
Xdega
<h2>
 
Posts: 124
Joined: Tue Mar 01, 2011 6:30 pm
Location: USA

Postby BlueBoden » Fri Mar 11, 2011 4:02 pm

Xdega wrote:
granor wrote:Using h1 like title is nonsensical. why would we need 2 elements that do the same thing?

^^ this.

I would much rather the content of the page be described in the headers <head> than in the body of the page. The <h1>through <h6> should be used at the designers discretion.

Code: Select all
<html>
   <body>
      <section>
         <h1></h1>
         <p></p>
         <h2></h2>
         <p></p>
         <h3></h3>
         <p></p>
      </section>
   </body>
</html>


should be valid. As should:

Code: Select all
<html>
   <body>
      <section>
         <h1></h1>
         <p></p>
      </section>
      <section>
         <h2></h2>
         <p></p>
      </section>
      <section>
         <h3></h3>
         <p></p>
      </section>
   </body>
</html>


I also think that for documents that are not that rich in content that they require multiple uniquely styled headers, the <h1> tag should just be used for simplicity:

Code: Select all
<html>
   <body>
      <section>
         <h1></h1>
         <p></p>
      </section>
                <section>
         <h1></h1>
         <p></p>
      </section>
                <section>
         <h1></h1>
         <p></p>
      </section>
   </body>
</html>


Don't take away that freedom. It's like locking everyone up in prison, because a few people commit crimes.

As I mentioned. Search engines, screen readers etc should focus on the documents headers <head> for content type and description.


They already do that to some degree, but they have to analyze the content as well, to make sense out of the page.

Screen readers will need to know about headings, and lists, to make it easer for users to navigate on the site.

Search engines will need to analyze page content for ranking purposes.


Your first example would not be valid, you have a section floating in thin air, with a bunch of headings in it. I'm not sure if this would trigger the old sectioning model in UAs, or if it would simply count as a single section, placed a little oddly.

Your second example is almost valid. What you have in your second example, is 3 subsections of body. You can easily style multiple h1s, it just requires some clever usage of css selectors, such as "element + element", and "element element", which would mean "select elements which comes after this element", and "select elements inside of element" respectively.

You may however consider using classes and ids, since it may be much easier in some situations. Especially to avoid overlapping declarations. Don't obsess about whether or not to include another class or id.
User avatar
BlueBoden
<h4>
 
Posts: 26
Joined: Wed Feb 09, 2011 4:40 am

Re: h1 element should only be allowed once

Postby nuevolutionWd » Thu Mar 24, 2011 8:05 am

Jab Creations,
I totally agree with you on using the h1 tag only once. I know HTML5 emphasizes that you can use the h1 tag just about anywhere. But! an hopefully someone from WHATWG can tell me is: What is the impact of using the h1 tag almost everywhere have an impact on Search Engine Optimization? I will take the other person's example and lets say I start with H6, H5, H4, and so forth down the line till I get to H1... how does that affect my optimization?
for example
Code: Select all
<header><h1>MY AWESOME WEBSITE</h1></header>
          <nav>Home ......</nav>
          <aside><h1>MY COMPANY RULES</h1></aside>
          <section><h1>Welcome to my company</h1></section>
          <footer><h1>Visit us soon!</h1></footer

I mean semantically it's written correctly, since I'm using all the html5 tags, but how do search engines look at the code? would it be better to use the header tag? rather than h1?
I think until we have a better understanding of how to implement the headings we should stick to the rivers we're used to. I hate over complicating things.
nuevolutionWd
<h6>
 
Posts: 3
Joined: Thu Mar 24, 2011 7:44 am
Location: California

Re: h1 element should only be allowed once

Postby Xacto01 » Thu Mar 24, 2011 9:27 pm

JAB Creations wrote:A well designed website should emulate a newspaper, after all you wouldn't see the big header, 'Won War!' and then half way down the page in the same font-size, 'Women shaves cat'. The h1 element should only be allowed to be used on the page once.


Websites are not newspapers per se, because they can be parsed and aggregated. For example, sections of your page could be ajaxed into another application and would break the flow of the outline. HTML5 specs multiple uses of H1's as okay since they are relative to the section they are in. For example: https://developer.mozilla.org/en/Sections_and_Outlines_of_an_HTML5_document. Somebody correct me if I'm wrong.
Xacto01
<h6>
 
Posts: 4
Joined: Thu Mar 24, 2011 8:07 pm

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests