views:

173

answers:

3

In this list (these are HTML 5 supported) tell me which tag is presentational and which is not. I found many different views on many articles , if some think any tag is presentational but some don't think.For example: in HTML 5 specification they don't think is presentational.

<abbr>

<address>

<area>

<b>

<bdo>

<blockquote>

<br>

<button>

<cite>

<dd>

<del>

<dfn>

<dl>

<dt>

<em>

<hr>

<i>

<ins>

<kbd>

<map>

<menu>

<pre>

<q>

<samp>

<small>

<span>

<strong>

<sub>

<sup>

<var>

Who decide which HTML tag is presentational and Which is not and how , Any group like W3C or any group of web developer? and which advice we should follow.

If tag is valid by w3c in used doctype then what are pros to not to use any x/html tag from any point of view

in user/usability/accessibility point of view

if we use more HTML tags then page without css will look good.

in developer point of view

if we use more available tag of html than we don't need to use it takes more time to write , it uses more charter than html tag in html and css both

For example:

instead of using

<span class="boldtext">Some text<span>

.boldtext {font-weight:700}

or we can also use

<b>Some text<b>

b  {font-weight:700} 

it looks cleaner , easier to use , uses less character( will reduce the page size) , more readable in source. and it doesn't' break the rule of content and presentation separation

or like this this if we want to give meaning

Edit: or like this

<b class="important">Some text<b>

b.important  {font-weight:700}

and whenever we want to change font-weight then we can change css only in both example.

If tag is valid by w3c in used Doctype then what are pros to not to use any X/HTML tag which is marked as presentational by some people not by W3C and HTML specifications?

Can we change any design without changing anything in HTML? Is this the mean of content and presentation separation?

and if any HTML tag is break the rule of separation then css property Content doesn't break also

see this article http://line25.com/tutorials/how-to-create-a-cool-anaglyphic-text-effect-with-css

and

Why is it allow the HEIGHT and WIDTH attributes for the IMG element . doesn't it break the rule of separation? good debate here :http://annevankesteren.nl/2004/01/images-height-and-width-attributes

+4  A: 

The whole distinction between "presentation" elements versus "structure" element is, in my opinion, a matter of common sense, not something defined by W3C or anyone else. :-P

An element that describes what its content is (as opposed to how it should look) is a structure element. Everything else is, by definition, not structural, and therefore a presentation element.

Now, I'll answer the second part of your post. I understand this is a contentious topic, but I'll speak my mind anyway.

Well-made HTML should not concern itself with how it should look. That's the job of the stylesheet. The reason it should leave it to the stylesheet, is so you can deliver one stylesheet for desktop computers, another one for netbooks, smartphones, "dumbphones" (for lack of a better term), Kindles, and (if you care about accessibility, and you should) screen readers.

By using presentation markup in your HTML, you force a certain "look" across all these different types of media, removing the ability of the designer to choose a look that works best for such devices. This is micromanagement of the worst sort, and designers will hate you for it. :-)

To use your example, instead of using <b>, you should ask yourself what the boldness is supposed to express. If you're trying to express a section title, use one of the header tags (<h1> through <h6>). If you're trying to express strong emphasis, use <strong>. You get the idea. Express the what, not the how; leave the how to the stylesheet designers.

</soapbox>

Chris Jester-Young
in my example i'm using <b> just for presentation not to emphasis. my question is not about <b> vs <strong>, it's <b> vs <span class="boldText>.
metal-gear-solid
@Jitendra: Ah, I see. I think using `boldText` for a class is pointless, because it's not describing a "what".
Chris Jester-Young
So it's better to use <b> in place of <span class="boldText> if both are not describing. and about ur point of describing HTML 5 has support for <small> tag and they think it semantic see accepted answer of this question http://stackoverflow.com/questions/2260024/why-big-is-not-in-html-5-tag-list-while-small-is
metal-gear-solid
To me, `<small>` is not semantic (I disagree with the "accepted answer"; fine print can have its own class, and it's not called "small"), but, I understand that reasonable people disagree about this. I would still avoid using `<small>`. To your first point, I agree that `<b>` is less evil than `<span class="boldText">`. But to whatever extent the class can be amended to specify a "what", even better.
Chris Jester-Young
@Chris Jester-Young - ok good point from your side but what about the use like this <small class="fine-print"> or <b class="important>
metal-gear-solid
@Jitendra: In my opinion, both of those are fine too (although some will disagree with me); this provides compatibility with non-CSS-capable browsers. This would allow stylesheets to freely choose how to render the "fine-print" and "important" classes (yes, even negating the bold/small if that's somehow inappropriate for the device being targeted).
Chris Jester-Young
@Jitendra: `<b class="important">` should be replaced by `<em>` or `<strong>` depending of the amount of emphasis attributed to the entity. As of `<small>`, it really does semantically represent fine-print. Quote from the HTML5 spec, section 4.6.4 - The `small` element: *Small print typically features disclaimers, caveats, legal restrictions, or copyrights. Small print is also sometimes used for attribution, or for satisfying licensing requirements.* http://dev.w3.org/html5/spec/Overview.html#the-small-element
Andrew Moore
@Andrew Moore - but if i'm using <b class="important"> only to give style not want to give emphasis for screen reader users then.
metal-gear-solid
@Jitendra: If you do not want to add emphasis, why are you calling your class `important`? See, here you subconsciously used a term used to described emphasis on your class name to describe your element therefore you do want to give emphasis.
Andrew Moore
@Andrew: Sometimes something that's "important" may be different from "strong emphasis". What if "important" text is required to have a warning sign on the margin whenever it appears? It seems overkill to do the same for `<strong>`, though of course it's possible to achieve. As for `<small>`, as I said, reasonable people can disagree, but I stand by my stance.
Chris Jester-Young
Can any one give me final list of presentational tags
metal-gear-solid
@Jitendra: From your list (and more :-P), I'd say: `b`, `i`, `u`, `tt`, `strike`, `font`, `center`, `blink`, `marquee`, `big`, and `small` are presentational. (Yes, the last one is disputed, but whatever. :-))
Chris Jester-Young
@ then what about tt, sub, sup, and, hr http://htmldog.com/reference/htmltags/presentational/
metal-gear-solid
@Chris Jester-Young: Even if the default style of `<em>` is italic, it doesn't need to stay that way. In this case, `<b class="important">` is definitively used for emphasis, `<em>` can easily be used to bold that element. As for the warning example, pretty much any text used as warning has an implied strong emphasis `<strong>`. That's the definition of a warning, isn't it? Strongly suggest against a behavior?
Andrew Moore
@Jitendra: I added `tt` (sorry, missed first time). `sub` and `sup` are used in some chemical and mathematical contexts that are hard to call anything but subscripts and superscripts. As for `hr`, well, I don't know; I think it has semantic value (it separates two sections of text; even screen readers can do a Big Pause when it sees an `hr`), but reasonable people can disagree.
Chris Jester-Young
@Andrew: Sure, I agree, one could/should use `<strong class="important">` or something, using the presence of the `important` class to determine which/whether any icons should appear, for example.
Chris Jester-Young
@Jitendra: `<sub>` and `<sup>` has semantic meaning in the case of mathematical and chemical/organic formulas. `<tt>` no longer exists in HTML5, but it has a semantic meaning in previous versions relative to raw data exchange.
Andrew Moore
@Andrew: `<tt>` having any semantic value is about as hard for me to believe as `<font face="Courier New; Courier; monospace">`. :-P
Chris Jester-Young
@Chris Jester-Young: A simple example would be morse-code. Morse-code has a semantic meaning in `<tt>`. The actual tag is called after a teletype for a reason.Also, the HTML5 spec document, as shown in my comment above, disproves that `<small>` is a presentational element. It is used to semantically represent legal text (small print) and even if you disapprove with this idea, if the official specifications says so, that's the final verdict. Therefore, **`<small>` is not a presentational tag, but has a semantic meaning.**
Andrew Moore
@Chris Jester-Young @Andrew Moore - and what you think about <br /> and <hr />?
metal-gear-solid
@Jitendra: `<br />` is semantic if the data represented by the parent entity contains a line-break and `<br />` is used to represent it. `<hr />` is semantic if the data represented by the parent entity contains a section break or a page break and `<hr />` is used to represent it (this is debatable). If used purely for display purposes, the tag has no semantic value. I would still classify `<hr />` as presentational, but not `<br />`
Andrew Moore
@Jitendra: Actually, the HTML5 has a nice semantic meaning for `<hr />`: *The `hr` element represents a paragraph-level thematic break, e.g. a scene change in a story, or a transition to another topic within a section of a reference book.* http://dev.w3.org/html5/spec/Overview.html#the-hr-element Maybe I was a bit too quick to make it a presentational element.
Andrew Moore
@Andrew: I hear you already about `<small>` and how HTML 5 thinks it's semantic. I agree that reasonable people can disagree about that, and, for the record, I still disagree. I also think using `<tt>` for Morse code is iffy, too. You can do `<tt class="morse">` or something, but `<tt>` standalone...no.
Chris Jester-Young
no one has replied about my last two query of my question related to CSS's content property and IMG element's width.
metal-gear-solid
@Jitendra: I think both `<br>` and `<hr>` have a place in structural markup. (Line breaks are used for flowing poetry a certain way, for example. Think of how one lays out a haiku.) I try to use them very sparingly, though.
Chris Jester-Young
@Jitendra: Personally, I think that stylesheets should specify images' sizes, using relative terms. Sometimes, in order to avoid unsightly scaling (pixelation, for example), you have to use pixel measurements; in that case, `width` and `height` attributes are acceptable, with full understanding that if the image size changes on you, that you'll have to update those pixel measurements too. I don't think that the `bgcolor` and `fgcolor` attributes of `<body>` should be used, though, nor `border` attributes of `<img>` and `<table>` (and the like).
Chris Jester-Young
@Jitendra: When looking at document semantics, always look if the data represented by the entity/attribute has a meaning to the data structure of the document or not. Using `content:` to add quotes around text located in a `<q>` element doesn't affect data structure (it is a quote after all the `"` are purely display elements, the quote itself is the data). Using the `width` and `height` attributes CAN affect data structure when the width/height of an image has meaning in the data structure. Therefore, it is semantic to use the attributes when it is meaningful to the document...
Andrew Moore
... the `border` attribute for example never adds to the data meaning of a document. Same applies to the `fgcolor` and `bgcolor` attribute of the `<body>` element. If `width` and `height` attribute has no intrinsic value to the data meaning of the element and is used purely for presentation purposes, you should style it using CSS.
Andrew Moore
@Andrew: Just so you know that I'm not always out to disagree with you, I actually agree with your last giant comment, and am now +1'ing both parts of them.
Chris Jester-Young
For example, using the `width` and `height` attributes on `<img>` showing different sizes of an icon (16x16, 32x32, 48x48) would be semantic as the `width` and `height` attributes represent the particular sizes of that icon (they are all different images of the same class, and its size has meaning). Using `width` and `height` on a thumbnail `<img>` of a larger image would not be semantic and should be done in the CSS.
Andrew Moore
@Chris Jester-Young: Don't worry, I'm not here to disagree with you neither. I'm just explaining theoretical semantics here, but in practice, I'm sloppy.
Andrew Moore
@Chris Jester-Young: I don't know why you'd disagree with my answer. HTML5 *does* give that semantic to the tag. The "`<small>` is for fine print" is not my opinion, it's the actual description of the tag from the HTML5 draft. http://www.whatwg.org/specs/web-apps/current-work/#the-small-element
Chuck
+1  A: 

W3C decides the semantics of tags. The specification documents of HTML5 gives conditions on the use of the various tags.

HTML5

To continue with your example, there is nothing wrong with using <b> to bold some text unless:

  • The text being bolded is a single entity already represented by a tag:

    Incorrect:
    <label for="name"><b>Name:</b></label>

    Correct: (Use CSS to style the element)
    label { font-weight: bold; }
    <label for="name">Name:</label>

  • The text is being bolded to put added emphasis and weight on a section or words of a block of text.

    Incorrect:
    <p>HTML has been created to <b>semantically</b> represent documents.</p>

    Correct: (Use <strong>)
    <p>HTML has been created to <strong>semantically</strong> represent documents.</p>

The following is an example of proper use of the <b> tag:

Correct:
<p>You may <b>logout</b> at any time.</p>

I realize that there doesn't seem to be a lot of difference between the above example and the one using <strong> as the proper example. To simply explain it, the word semantically plays an important role in the sentence and its emphasis is being strengthened by bold font, while logout is simply bolded for presentation purposes.

The following would be an improper usage.

Incorrect:
<p><b>Warning:</b> Following the procedure described below may irreparably damage your equipment.</p>

Correct: (This is used to add strong emphasis, therefore use <strong>)
<p><strong>Warning:</strong> Following the procedure described below may irreparably damage your equipment.</p>


Using <span class="bold"> is markup-smell and simply shouldn't be allowed. The <span> element is used to apply style on inline elements when a generic presentation tag (ie.: <b> doesn't apply) For example to make some text green:

Incorrect:
<p>You will also be happy to know <span class="bold">ACME Corp</span> is a <span class="eco-green">certified green</span> company.</p>

Correct: (Explanation below)
<p>You will also be happy to know <b>ACME Corp</b> is a <em class="eco-green">certified green</em> company.</p>

The reason here why you would want to use <em> as opposed to <span> for the word green is because the color green here is used to add emphasis on the fact that ACME Corp is a certified green company.

The following would be a good example of the use of a <span> tag:

Correct:
<p>You may press <kbd>CTRL+G</hbd> at any time to change your pen color to <span class="pen-green">green</span>.</p>

In this example, the word green is styled in green simply to reflect the color, not to add any emphasis (<em>) or strong emphasis (<strong>).

Andrew Moore
Even using `<b>` for "(required)" or "ACME Corp" is wrong. It should be something like `<span class="required">` and `<span class="company">` respectively, which describes what those strings are; they're not "a bold", whatever that is. :-)
Chris Jester-Young
As for "ducks", that's what `<dfn>` is for. :-) Style it with bold if you prefer, but seriously, I wouldn't use wiki markup as the model of "right markup".
Chris Jester-Young
@Chris Jester-Young: `<span>` IS NEVER semantic. It is a generic element used when the element represented doesn't fit any other category. While I agree that `<span class="required">` would be the proper way to go here, I have to disagree for the company, as it is used once. In the case of a company listing or a particular page where the company has a certain meaning, then `<span class="company">` would be the way to go. You are also right about `<dfn>`, I forgot about that element. Finding another example...
Andrew Moore
@Andrew: `<span>` itself is not semantic. It's the classes you attach to it that's semantic. The point of `<span>` and `<div>` is that they're (supposed to be) free of overloaded presentational assumptions.
Chris Jester-Young
@Chris Jester-Young: correct, but the classes attached to them need to have a meaning related to the data enclosed in them. By using `<span class="company">`, you are implying that the company has an importance in the data structure of the document, while in this case it is simply part of the text and not a meaningful entity.
Andrew Moore
@Andrew: If it's "simply part of the text", when why does it need to be bold? _What_ does its boldness add? Encapsulate this "what-ness" in the class.
Chris Jester-Young
@Chris Jester-Young: Because the mangers like to see the name of their company bold. It adds to my job security. There is no other reason.
Andrew Moore
@Andrew: How about using `our-company` as the class.
Chris Jester-Young
@Chris Jester-Young: Still, `ACME Corp` has no intrinsic value to the document and could be easily has replaced by `We`. It is therefore non-semantic to add an element class for a data field which has no value in the eyes of the current document data structure other than text. Even `<span class="eco-green">` semantically is incorrect as it has no value to the document data structure. It's text. But unfortunately in this case, we need to style it.
Andrew Moore
A: 

It's not that presentational elements should be avoided, it's that markup should be as semantic as possible. When designing a document structure, default styling should be considered a secondary affect. If an element is used solely for presentation, it's not semantic, no matter what element is used.

The example usage of <b> isn't semantic, because <b> imparts no meaning. <span class="boldtext"> also isn't semantic. As such, their usage is mixing presentation into the structure.

outis