21: Lesser-known semantic elements

Forums » Dev.Opera » Archived Article Discussions

This topic has been closed. No new entries allowed.

Reason: You can now post comments on articles on Dev Opera

Forum rules and guidelines

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

8. July 2008, 07:16:49

mnfrancis

Posts: 0

21: Lesser-known semantic elements

This article covers the less common semantic elements in HTML, that exist to identify specific common types of content - contact information, citations, abbreviations, superscript and subscript, insertions and deletions, line breaks, and more.

( Read the article )

8. July 2008, 15:54:28

remysharp

Posts: 3

This has been playing on my mind for some time now - but regarding how to indicate what language code is written in - there is, kinda a way to do it.

Why can't we use the 'lang' attribute? It's valid and we can make use of the 'x-' experimental value:

<code lang="x-javascript">(function () { /* do stuff */ })()</code>

http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang

What are people's thought/feelings on this?

8. July 2008, 16:16:38 (edited)

dorward

Posts: 16

Originally posted by remysharp:

Why can't we use the 'lang' attribute?



Because it is explicitly marked as being for natural languages and not for computer languages.

See http://www.w3.org/TR/html4/struct/dirlang.html#h-8.1.1

I'd stick to class names for this (which has the advantage of allowing things such as <code class="javascript language-keyword"> for syntax highlighting)
David Dorward
http://dorward.me.uk/

8. July 2008, 16:19:05

dorward

Posts: 16

Originally posted by mnfrancis:



In the following example, the address is contained within the footer paragraph and simply links to another page on the site.

( Read the article )



Unfortunately the address element is defined as a block and may not be a child element of paragraphs (at least in HTML 4.01 Strict).
David Dorward
http://dorward.me.uk/

8. July 2008, 16:22:09

I'm sad to see that this article repeats the false notion that <var> is meant for marking up variables in programming languages. It's not. Think about it: why would one invent an element type for variables, but not one for constants, one for functions, one for classes, etc.?

No, <var> is meant for marking up variable parts of an expression, usually an example. It's a placeholder; something that shows that a real value should be substituted when used in a concrete situation.

Like when you're explaining how employees' email addresses are made up: <var>firstName</var>.<var>lastName</var>@example.com.

Or like this, "redirect your telephone by pressing <kbd>* 21 * <var>extension</var> #</kbd>". You're not meant to type in "*21*extension#" literally; the "extension" bit is meant to be replaced with the actual extension to which you want to redirect, like "*21*4572#".

It's a common misunderstanding, but I was disappointed to see it in this series, which has been of very high quality up to here.
Tommy Olsson

9. July 2008, 15:01:28

zcorpan

Posts: 9

In two examples address is nested in p but that's not allowed in HTML. In the first example (the copyright footer) the address element should go and in the second (the br-in-address) the p element should go.

9. July 2008, 16:37:11

Opera Software

chrismills

Posts: 378

Thanks for the feedback guys - we'll explore your points, and make corrections to the article as necessary.
Chris Mills
Developer Relations Manager
Editor, dev.opera.com and labs.opera.com

12. July 2008, 05:44:11

codebyjoe

Posts: 58

mnfrancis,

this article inspired me big time. after reading this article i modified how my voice web site app speaks its articles. I was using ids and the vxml:prompt tag. Now i'm using javascript to extract text from the article html code and modifying the text. The home page at my site is a good example with abbreviations and acronyms and the source code shows how its done.

thanks for the inspiration
joe budd http://voice.codebyjoe.com/

17. September 2008, 00:12:02

SansGravitas

Posts: 3

Just wanted to point out the inaccuracy of the difference between an abbreviation and an acronym. Yes, an acronym is a form of abbreviation, but it has nothing to do with how the abbreviation will be pronounced. An acronym is merely an abbreviation consisting of the initial (or sometimes more) letters of words in the phrase. Therefore, both HTML and CSS are acronyms.

17. September 2008, 00:30:37

codebyjoe

Posts: 58

SansGravitas,

You make an excellent point and thank you.

Here is what i was taught in school.
http://searchcio-midmarket.techtarget.com/sDefinition/0,,sid183_gci211518,00.html

I honestly don't know what is correct anymore.

19. September 2008, 16:23:19

Opera Software

chrismills

Posts: 378

Originally posted by SansGravitas:

Just wanted to point out the inaccuracy of the difference between an abbreviation and an acronym.



I agree - you are right. Do you think any wording needs ot be changed in the article?
Chris Mills
Developer Relations Manager
Editor, dev.opera.com and labs.opera.com

23. September 2008, 12:54:04

greut

Posts: 6

Hi,

Why taking the /wrong/ example of <address> to demonstrate the
usage? It's confusing.

24. September 2008, 06:29:38

Opera Software

chrismills

Posts: 378

Originally posted by greut:

Why taking the /wrong/ example of

to demonstrate the usage? It's confusing.



Can you explain in a bit more detail why you think this is confusing? The article shows two correct uses of the <address> element, and then an incorrect usage of it, which is clearly stated to be incorrect. I'm not saying you're wrong - you could be interpreting something I'm not seeing - but I don't see why this is confusing.
Chris Mills
Developer Relations Manager
Editor, dev.opera.com and labs.opera.com

2. February 2009, 20:25:01

stelt

Posts: 59

"the address is contained within the footer paragraph".

I guess the code is changed, but the text isn't yet changed accordingly.

Forums » Dev.Opera » Archived Article Discussions