I agree, I use this reference a lot but I was thinking about something that could tell you something like... never use a p tag inside an H1 tag or something like that.

I guess I'm wishing for something I should learn by trial and error, or perhaps read more about the topic.

Thanks

ralphm
—
2011-06-13T13:50:27Z —
#4

Well, there is the official documentation for each language, of course. :eek: (Not that it's much fun trying to wade through all that stuff! It's like the proverbial Cone of Silence to me.)

This is a handy HTML reference that I found out about recently in another post: HTML 4 Elements

It gives a fair bit of info on how each element can be used.

EarlyOut
—
2011-06-13T13:59:09Z —
#5

(Replying to fs_tigre)

Laid out as a "do this, don't do this" list, it would probably end up being longer than the reference works, since there are so many permutations and combinations.

BTW, I think you're confusing "syntax" with "semantics."

Proper syntax refers to using language elements in the right sequence, combined in correct ways.

In the HMTL context, "semantic" refers to whether something has "meaning," or whether it's just applied for styling purposes. So, an <li> tag has a meaning - it says, "This is a list item." An <h1> tag has a meaning - it says, "This is the main topic of this page" (or something like that - always a source of debate!).

A <font> tag, on the other hand, has no meaning, so it's not "semantic." It's not telling you that the material that follows is a font. It's telling the browser how to style that content.

There's a school of thought that says that all HTML tags should be semantic, and that all styling should be done in the CSS. Of course, they immediately carve out huge exceptions for tags like <div> and <span>, which don't really mean anything, so it's an ideology that isn't particularly consistent.

PatrickSamphire
—
2011-06-13T14:23:14Z —
#6

div and span do have some semantic meaning, if not much. A 'div' is a division of a page, a section, if you like. A 'span' is a span of text, in other words, a small selection. Those are semantic, by themselves. The problem is that they convey very little meaning because they are so general. Which is why HTML5 has introduced more semantic tags (much to the disgust of certain people on this forum).

fs_tigre
—
2011-06-13T14:23:55Z —
#7

ralph.m

This is a handy HTML reference that I found out about recently in another post: HTML 4 Elements

Very good reference, thanks a lot!

EarlyOut

Proper syntax refers to using language elements in the right sequence, combined in correct ways.

You are right I was confused but I really meant all, I thought syntax was part of semantics, sorry.

Any reference for syntax?

One more question.

When talking about SEO what matters the most, syntax or having your elements semantically correct, or both?

ralphm
—
2011-06-13T14:34:44Z —
#8

fs_tigre said:

Any reference for syntax?

My link above deals with syntax, such as what element can be used where.

EarlyOut
—
2011-06-13T14:35:48Z —
#9

PatrickSamphire said:

A 'div' is a division of a page, a section, if you like.

True in theory, but in practice....

And let's face it, the meaning of <span> is usually, "I'm going to apply some styling to this text."

PatrickSamphire
—
2011-06-13T15:28:14Z —
#10

EarlyOut said:

And let's face it, the meaning of <span> is usually, "I'm going to apply some styling to this text."

Yeah, but it's "I'm going to apply some styling to this span of text".

fs_tigre
—
2011-06-13T15:49:10Z —
#11

Thank you all!

Stevie_D
—
2011-06-13T22:26:01Z —
#12

fs_tigre said:

Any reference for syntax?

Run it through The W3C Markup Validation Service and anything that's syntactically invalid will be thrown back as an error. You'll soon get used to spotting things, like <p> inside <h1>, that get thrown back!

When talking about SEO what matters the most, syntax or having your elements semantically correct, or both?

Semantics are more important to SEO, as they help googlegod to understand your site. Syntax has many benefits, not least that it makes the appearance and behaviour of your site more predictable on different browsers and platforms, but SEO isn't one of those - googlegod really couldn't care less about being the W3's policeman and enforcing coding rules arbitrarily.