954,595 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Heading tags and div tags

I would like to use and tags to emphasize important keywords for SEO purposes. Is it XHTML-transitional legal to enclose a tag inside an tag?

cscgal
The Queen of DaniWeb
Administrator
19,436 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 230
 
I would like to use

and

tags to emphasize important keywords for SEO purposes. Is it XHTML-transitional legal to enclose a tag inside an

tag? I believe it is, but why... You could just apply the class to the

tag:

or assign the style to it in your style sheet: h1 { some-style:xxx; } Then all

's would inherit that style... Make sense? If you are after another result, please share.... I am curious.

JasonRCS
Newbie Poster
13 posts since Jul 2004
Reputation Points: 13
Solved Threads: 1
 

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:

DaveSW
Master Poster
769 posts since Jul 2004
Reputation Points: 54
Solved Threads: 20
 

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 ).

rrdavik
Newbie Poster
1 post since Feb 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You