Page is a not externally linkable
- Code, Content, and Presentation
-- CSS
---- CSS, SEO and semantics


SuzyUK - 9:00 pm on Nov 25, 2009 (gmt 0)


Hi mostever, interesting topic you started and some great replies.

I don't think this is anything to do with the browser wars per se. As has been said already the Web is a tangled mess of code which the Browsers and the SE's do a not bad job of interpreting considering ;)

As for yourself and many others yes we believe that the cleaner we can make our code the easier it makes everyones jobs! Browsers can hopefully render it quicker, SE's and text browsers can understand it easier, and CSS works!

Any standard will do HTML or XHTML, (X)HTML is what most of the old school (not the oldest school) use because at one time it was supposed the language of the future, it's likely that HTML5 will become the language of choice for most average Webmasters going forward, although XHTML5 is also available.

HTML4 is the solid grounding no matter which flavour you use, and XHTML is just slightly more strict in that it (if you want it to validate) forces you to use closing tags, or close all elements. This is good basics and I highly recommend anyone to get used to validating their code against an XHTML Doctype whether they intent on using it or not.

Not everyone is aware that there are "implicit" closing tags in HTML4 and therefore they can't understand why an element they haven't closed is not styling like it should (then they blame CSS!) Andy, possibly this is a cause of divitis too?

e.g. it is quite legal to write:

<p>here is some of the items on my list;
<ul>
<li>item one
<li>item two
</ul>
</p>

However it might not render as you think if you're trying to CSS a background onto that <p>aragraph.. the browsers will implicitly insert a closing </p> just after "list;</p>". Then they will then ignore the closing </p> tag after the </ul>

That is the right thing for them to do, but for those not in the know, that's the start of spaghetti code and why you can't use a <p> to contain other elements ;)

That should have no bearing on the SEO factor of a document either, and all browsers will handle it. However if you'd tried to validate that code against an XHTML doctype the validator would have shown you the error of your ways, and made your CSS troubleshooting a lot easier.

You don't have to use an XHTML Doctype to render the code, and HTML4.01 strict one will do and you have the knowledge that your code is as clean as possible for all, SE's Browsers and your CSS File! ;)

As for the semnatics of <b>, <i>, <em>, <strong> there is no reason for you to remove them from your HTML, it is believed they don't carry that much SEO weight due to abuse in the past but that may change, write the document for the people not the opinion. The argument over whether to use <em> over <i> or <strong> over <b> is purely semantic and I think HTML5 kept the shorter ones in purely because they are shorter, I believe they probably have equal weight nowadays.

However when you're saying that for clean code you want to remove them to the CSS, you don't remove the HTML tag, leave it in if it has text/audio meaning as in if you listen "em" or "i" will emphasise a word, if that's right, then it's in the right place. You simply then use your CSS to visually style those four elements how you want . i.e you can override the bold on the <b> and <strong> and make it red instead.. but you have not altered the meaning of the plain text document, nor an SE's reading of it.

So don't use unnecessary spans if there is an existing HTML element that will suit for the wrapper, all elements are boxes and are capable of being styled via CSS, the SE's a text browser and couldn't care less what the page looks like, they want the plain meaning.

It's a lot of common sense, it's not just about standards, although that would be nice, it's simply making it as easy as possible for one seems to have a knock on effect all the way along ;)

Oh and before I forget, Welcome to WebmasterWorld!


Thread source:: http://www.webmasterworld.com/css/4031706.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com