Forum Moderators: open

Message Too Old, No Replies

<br> or <p> - semantics and rendering instructions

         

bartainer

5:48 pm on Apr 10, 2005 (gmt 0)

10+ Year Member



Hello;

Okay, should I use the <p> tag or <br> tag when coding? Some say the <p> tag is not the tag of choice? Rather use the <br> "shift and enter" keys instead of the <p> "enter" key (Windows). Please help? Dreamweaver is my program.

Ron

tedster

5:53 pm on Apr 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use to <p> to indicate actual paragraphs - sections of content that are related as the single semantic unit traditionally known as a paragraph.

Use <br> to indicate a line break with no semantic meaning.

bartainer

5:54 pm on Apr 10, 2005 (gmt 0)

10+ Year Member



Thank you!

Ron

bartainer

5:58 pm on Apr 10, 2005 (gmt 0)

10+ Year Member



Tedster;;Could you explain "semantic meaning"? Not to sound uneducated, but people have different meanings for various phrases. I have seen your postings and replies, I know that you have a good background for design. Thanks.

Ron

tedster

8:00 pm on Apr 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Semantic means, well, meaning itself -- "having to do with the meanings of words and symbols". It's all about the actual information being conveyed. Paragraphs are a semantic convention - the grouping of a meaningful unit. In "proper" content, each paragraph has a slightly different semantic focus, theme, or meaning - however you want to frame it. As you read through the content, each paragraph represents a shift, a new angle, facet, sub-theme of the overall topic.

So <p> is one kind of mark-up that conveys semantic information, but <br> is a simple rendering instruction. How a <p> is rendered visually can vary widely, depending on the stylesheet rules. But it is still a paragraph - a semantic unit of a particular kind.

What has gone on in HTML over time is important to understand if you want to grok the changes from HTML 3 to HTML 4 transitional to HTML 4 strict.

HTML is one type of SGML -- S(tandard) G(eneralized) M(arkup) L(anguage). The mark-up HTML provides was supposed to indicate meaning, not rendering instructions. However, by the time HTML 3 arrived, HTML had strayed far from its SGML home. We had, most especially, the rendering-only instruction of the <font> tag.

We also had lots of coders using tags like <blockquote> when there was no quote involved at all - just to get an indent! When I was first learning HTML, I read one tutorial that said "<p> is shorthand for two <br> tags." Now that's just wrong.

So common practice was trashing the semantic roots of a true mark-up language, and the browser wars (with all the non-standard "innovation" that came along with the warfare) were adding in non-semantic mark-up at warp speed.

By the time we arrived at HTML 4, the W3C realized clearly that for the future, semantics and rendering instructions needed to be separate. Semantics should be the realm of HTML and rendering the realm of stylesheets.

But the two areas had become so intertwined that untangling them was clearly going to involve a process, not one bold stroke. That's the principle difference between "transitional" and "strict" mark-up. Transitional mark-up (whether html or xhtml) is a 'transition', a step toward the separation of semantics and rendering. Strict mark-up is a giant step in that direction.

Although "strict" is not really not pure enough for a truly purist take on the whole issue, the separation is dramatic compared to HTML 3. And anyone who has made the shift to strict mark-up knows that they have given the search engines a much easier document to handle, and the rewards on the SERPs can be remarkable.

And all of this is why one of my soapbox issues is the importance of learning strict mark-up, compared to writing transitional anything at all, xhtml or html 4.

isorg

8:17 pm on Apr 11, 2005 (gmt 0)

10+ Year Member



I have heard it said that there are backward-compatibility issues with "strict" i.e. older browsers can't deal with CSS properly. So aim for "transitional" rather than "strict".

Is this true or a myth? If it is true, is it a big problem, or do the SEO/usability benefits of "strict" outweigh the concern that a small % of visitors using older browsers will have problems?

tedster

10:21 pm on Apr 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I work almost exclusively with html 4.01 strict in standards mode these days, and I haven't come across anything like that. Do you have specific areas that are a problem? Or are you trying to create pages for REALLY old browsers?

isorg

10:26 pm on Apr 11, 2005 (gmt 0)

10+ Year Member



No, my site is for all browsers. But I was using the CSE HTML Validator, and this is a issue it mentions on the topic of strict vs. transitional. Based on the discussion here however, I think I will give strict a try and see how it goes.

BTW, thanks for the info above.