Forum Moderators: not2easy
I'm trying to build an accessible and SEO friendly site. I'm a little confused as to how SE interpret heading versus lists. I am using lists to create sections headers that happen to be links as well. Can I use an h2 tag to denote a header inside an li tag? W3C validates it correctly, but from a point of semantics is it correct? Does it also impact SEO?
The same question I have for using <strong> insite an h1 tag. Does it make a difference? Is it semantically correct? And does it impact SEO?
Many thanks.
by the rulebook, yes your HTML will validate becasue yes an <li> element can contain other in flow elements (note a <ul> can only contain li elements so don't nest the Hx tag inside the ul without putting it in a <li>), like Div's headings etc. so there's no reason why not to use them if it makes sense for your application.
I would however say that while yes it's technically OK to nest an inline element like <strong> inside the Hx element it's not likely to affect the weight very much, it might give a double "boost" as far as the SE's are concerned, but I'd be very surprised. Adding in the <strong> might even dilute it?
The heading can be styled bold or not using the CSS, direct on the Hx tag.
re: dilution it's just a thought but say the SE's weight Hx element different from <strong> i.e. they place more importance on the Hx if the <strong> is nearest to the text, which it should be, the text might gain the lower weighting.. this is all theory and I'm not even sure this still applies, but before when you broke up header text with spans (another inline element) it did affect how it was indexed.
e.g. A popular usage of that was to target the first letter..
<h1><span>T</span>his is my Heading</h1>
however I don't know if this still applies. But I wouldn't like to chance "diluting" the headers with any extraneous tags, just my opinion of course.
You had some very interesting comments that fall in my own line of thinking. I also theorized that having extra markup in the hx tags could alter the way an SE indexes keywords. This is what gave rise to my questions.
I think I will go with <ul><li><h2><a href> on my navigation since they are indeed section titles, and opt against using <strong> unless it's within a <p>... which leads me to another question: Does an SE index text found in li as page content?
For example, I have a list of three titles each with it's own descriptive text. I employed a <ul> tage with three <li>s, where each <li> lists the title followed by the text. The structure is as follows: <ul><li><h2>title</h2>text</li></ul> I'm afraid that since the bulk of my text is in the li, the search engine will not give it weight as page content. Are my fears well founded?
Also, is it imperative to have a <p> with some text to follow each <h2>?
I'm trying to build an accessible and SEO friendly site<snip/>I don't know, but I doubt if its beneficial for either SEO or accessibilityusing <strong> insite an h1 tag. Does it make a difference?
To my (sighted) eyes, it seems that strong tags nested inside h1 tags makes no difference visually
A while ago I wondered if it might make a difference audibly (i.e. with screen readers), and found a study that concluded "NO":
[paciellogroup.com...]
In a recent thread on the Web Standards Group mailing list, the question arose about whether Screen Readers support semantic HTML elements such as strong and em. The short answer for the two main screen readers JAWS and Window Eyes is no. Neither do they support i or b for that matter. What is meant here by support is, do they using default settings provide an indication to the user by changing voice or some other method when text content is marked up using these elements, or do they have the option to provide an indication in their HTML specific settings.
Does an SE index text found in li as page content?
Yes as far as I know, I had some pages open and ran a search for some text that was in lists, it found it with or without quotes.
I would also like to imagine that as long as the text is relevant, and not stuffed, that lists, just like in word documents or presentations, might actually help, i.e. "bullet points"
Lists can often make for easier human reading so why not SE reading ;)
Also, is it imperative to have a <p> with some text to follow each <h2>?
Lavazza, that is interesting, I think mattur recently pointed that out on the other semantics thread too, it just kind of backs up the don't dilute theory too, a heading should have a strong enough semantic meaning without the <strong> tag.
Unfortunately I am working on a splash page that is structured in a way which does not really require or even allow blocks of text, which gives the appearance that my heading are redundant when in fact they are not.
my musings too ;): your em example and my span, (or strong) is where I would be wary of "dilution" seeing as it really does not have any extra meaning, I think I would tend to avoid it altogether? the extra Jaws information just kind of backs up that wee thought.
@abitdodgy
putting a <p> inside the <li> should not make it fail validation?
e.g. this validates just fine (though this is where I meant the <p> might be optional, depending on if you've other blocks of content to go in there)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Page Title </title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<style type="text/css" media="screen"></style>
</head>
<body>
<ul>
<li><h2><a href="#">This Page</a></h2>
<ul><li class="about"><p>some more information about this particular page</p></li></ul>
</ul>
</body>
</html>
perhaps if you're using nested lists there was something else wrong?
if you post a code sample of what you're trying to achieve a second pair of eyes might be able to help?
edit oops I even missed a closing </li> before the final </ul> but that doesn't matter in HTML validation as closing </li>'s are optional, so it's still implicitly closed, however I ususally always like to put them in sample code just to clear, if you're using XHTML validation then that closing </li> would be required!