943,453 Members | Top Members by Rank

Ad:
Jul 21st, 2004
0

Heading tags and div tags

Expand Post »
I would like to use <H1> and <H2> tags to emphasize important keywords for SEO purposes. Is it XHTML-transitional legal to enclose a <div class="blah"> tag inside an <h1> tag?
Similar Threads
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Aug 4th, 2004
0

Re: Heading tags and div tags

Quote originally posted by cscgal ...
I would like to use <H1> and <H2> tags to emphasize important keywords for SEO purposes. Is it XHTML-transitional legal to enclose a <div class="blah"> tag inside an <h1> tag?
I believe it is, but why... You could just apply the class to the <h1> tag: <h1 class="blah"> or assign the style to it in your style sheet:

h1 { some-style:xxx; }

Then all <h1>'s would inherit that style...

Make sense? If you are after another result, please share.... I am curious.
Reputation Points: 13
Solved Threads: 1
Newbie Poster
JasonRCS is offline Offline
13 posts
since Jul 2004
Aug 7th, 2004
0

Re: Heading tags and div tags

I'd prefer to use a span as it's inline. If you put a div in a h1 and put it into the wdg validator - http://www.htmlhelp.com/tools/validator/direct.html it fails, though for a reason I don't actually agree with. (h1 isn't inline to the best of my knowledge).

However the only reason I've used this sort of thing for is avoiding box model problems by putting width on one and margins one the other. Is there another use? :curious:
Reputation Points: 54
Solved Threads: 20
Master Poster
DaveSW is offline Offline
765 posts
since Jul 2004
Feb 23rd, 2010
0
Re: Heading tags and div tags
W3C recomends to use divs for the style and h1, h2 for the brief titles of the sections, subsections...

Anyway it is allowed to use class in h1, h2.. elements, so under my point of view you can give style to the h elements.

Other subject is to put block's inside the h elements that will be consider as other information block, and that's not a brief title, so that's the reason validators will complain ( I think ).
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rrdavik is offline Offline
1 posts
since Feb 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Problems with header...
Next Thread in HTML and CSS Forum Timeline: HTML Advice: Architecture & Tables





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC