Web Hosting Talk







View Full Version : Which XHTML element to use???


seodevhead
09-01-2006, 01:37 PM
I have a message posting board, similar to a very simple forum. And it lists the title of the message, a snippet and then under that it simply says:

"Posted By: {username here}"

Since this "posted by" line is a block level element (on its own line) I am now wondering what xhtml element(s) to assign to this?

I had it originally in a <p> tag but it certainly is not a paragraph. The only other option I can see is using a <dl> definition list perhaps... kinda like:

<dl><dt>Posted By:</dt><dd>{username here}</dd></dl>

Any suggestions as to what I should use? I want to comply with web standards/accessibility as much as humanly possible. Thanks.

the_pm
09-01-2006, 01:55 PM
This is one of those times when using a table is not wrong, because you are presenting fields of data which relate to each other in a tabular manner. Using a definition list means, semantically speaking, with each line, you are redefining the term "posted by," which is not the case. You want all instances to have meaning all at once. "Posted by" would be a heading, under which all data related to that field would reside.

seodevhead
09-01-2006, 02:12 PM
Actually this "posted by" message is only displayed once on each page.... each user's post has it's own page. Does that make things any different?

the_pm
09-01-2006, 02:15 PM
Ahh, I see. I'd say it can be presented as tabular data or as a definition list, like you've suggested. I would say you're ok using a definition list in this case :)

seodevhead
09-01-2006, 02:28 PM
Thanks so much the_pm...

One last question....

When writing xhtml elements, say for instance this definition list, does putting a space between the coded elements or not make any difference?

An example..

<dt>Name</dt><dd>the_pm</dd>

as opposed to..

<dt>Name</dt> <dd>the_pm</dd>

Why I ask this is because of search engines. Since on the first example there is no space, would the search engines read that line as 'Namethe_pm'??? Do you kinda get my drift? Or do search engines know to seperate words in different elements? Thanks.

the_pm
09-01-2006, 02:34 PM
Nope, there's no difference. A space may end up showing somewhere on the page, but other than that, each element is uniquely defined, and that's that :)

seodevhead
09-01-2006, 02:38 PM
So for instance, if "<dt>Name</dt><dd>the_pm</dd>" code managed to be part of google's snippet for one of your particular pages, it would actually show a space between "Name" and "the_pm" in the snippet? I always thought it would show "Namethe_pm" if you didn't space the two xhtml elements.