8 replies [Last post]
krystof
krystof's picture
Offline
newbie
Last seen: 13 years 50 weeks ago
Joined: 2005-09-01
Posts: 6
Points: 0

I would like some opinions on the following "borderline" codings that are frequently denounced in articles. Are these officially "deprecated"--or are they just "less meaningful"?

<br>&nbsp;<br>

At least one article uses this as an example of "undesireable" practices that are made unnecessary by CSS.

However, one thing I like about CSS is the display:inline feature. This allows me to make <h4> subheadings inline with the following text. I find this extremely appropriate. These <h4> subheadings summarize the text that follows. It is tasteful to put them inline. And this helps search engines to summarize what I am writing about.

Problem:
display:inline disables margin:top in IE6.
Possible solutions:
<p><h4>subheading</h4>text text text</p>
<div class="p"><h4>subheading</h4>text text text</div>

Or what is far easier with my editing software and I think most appropriate:
<br>&bsp;<br><h4>subheading</h4>text text text

Anything wrong with this? (Also incidentally, will <br><br> work just as well as <br>&nbsp;<br>? Or without the &nbsp; is it uncertain whether two blank lines will show?)

Now about <b or i>. I understand these are "unsemantic" but often the use of bold or italics IS unsemantic. For example:

"I agree with George Bush but I don't think America can afford his foreign policy."

Is there any reason to use the code <strong>but</strong>? No. You are flagging the search engines that this text is about "but" which is ridiculous, not to mention "unsemantic."

On the other hand, this of course is a different matter:
"I agree with George Bush but I don't think America can afford his foreign policy."

In this case <strong> would be appropriate.

My point: bold text may have intrinsic semantic meaning--or it may not. It is a good therefore to have 2 ways to activate bold text. I can not agree that <b> always means the same as <strong> and that <b> should be eliminated. And the same of course for <i>.

...but are <b or i> actually "deprecated"? (If so, then I guess I must change to <span style="font-weight:bold"> instead of my non-semantic <b> etc.)

Cyberman
Cyberman's picture
Offline
Regular
Last seen: 14 years 27 weeks ago
Joined: 2005-02-11
Posts: 37
Points: 0

&quot;Deprecated&quot;? &lt;br&gt;&lt;br&gt;, b, and i?

I don´t think search engines actually care wether there is a "<b>" or "<strong>" in the text.
The "<strong>" merely means that whatever it encloses is to be emphasized strongly.
So I think it´s quite fitting for your example "but", as you´d speak it more forcefully as well.

"<b>" does have no semantic meaning at all - if you want text to be bold, then make it bold - using CSS.
Anything that doesn´t have semantic meaning should be banned from HTML and put into CSS.
Think about screen-readers - how are they supposed to know the "<b>" is merely for design?

Anonymous
Anonymous's picture
Guru

Re: &quot;Deprecated&quot;? &lt;br&gt;&lt;br&gt;, b, and i?

krystof wrote:
Possible solutions:
<p><h4>subheading</h4>text text text</p>

You can't place a heading element inside a paragraph element.

Quote:

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

krystof
krystof's picture
Offline
newbie
Last seen: 13 years 50 weeks ago
Joined: 2005-09-01
Posts: 6
Points: 0

&quot;Deprecated&quot;? &lt;br&gt;&lt;br&gt;, b, and i?

Thank you, Triumph and Cyberman.

It looks like it's alright to use <br>&nbsp;<br>.

Cyberman wrote:
Think about screen-readers - how are they supposed to know the "B" is merely for design?

I can not imagine why they should need to know. "B" means bold---READ IT LOUDER. "Strong" means strong--READ IT LOUDER. They look the same to visual readers and they can sound the same to audio readers. What's the prob?

However, "B" is not merely for "design" in my examples above. It is used to clarify meaning which is OUTSIDE the "B" "/B." If the meaning is INSIDE of the code, then I would prefer <strong></strong>.

Of course, this is not an "official" explanation but my own "practical" use. I have received another reply elsewhere that explains, "B" and "I" have certain precise literary meanings for audio readers. I will need to study this. Any links to "official" explanations would be appreciated...Thank you!

firstreflex
firstreflex's picture
Offline
Enthusiast
Brooklyn USA
Last seen: 12 years 24 weeks ago
Brooklyn USA
Timezone: GMT-5
Joined: 2003-10-21
Posts: 104
Points: 0

&quot;Deprecated&quot;? &lt;br&gt;&lt;br&gt;, b, and i?

Anonymous
Anonymous's picture
Guru

Re: &quot;Deprecated&quot;? &lt;br&gt;&lt;br&gt;, b, and i?

krystof wrote:
"I agree with George Bush but I don't think America can afford his foreign policy."..."I agree with George Bush but I don't think America can afford his foreign policy."
Uh oh! The libertarians are restless. Wink

krystof
krystof's picture
Offline
newbie
Last seen: 13 years 50 weeks ago
Joined: 2005-09-01
Posts: 6
Points: 0

&quot;Deprecated&quot;? &lt;br&gt;&lt;br&gt;, b, and i?

Oh alright Triumph. I do not agree with George Bush but I think America has plenty of money to throw around. Heh heh.

...and thank you for the excellent references, FirstReflex...

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 4 years 44 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

&quot;Deprecated&quot;? &lt;br&gt;&lt;br&gt;, b, and i?

krystof wrote:
It looks like it's alright to use <br>&nbsp;<br>.

You don't need a non-breaking space between two breaks (or 'breaking spaces') because the 2nd break effectively cancels it out.
Also, if you're using two <br>s consecutively, you should really be using <p> instead.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

Anonymous
Anonymous's picture
Guru

&quot;Deprecated&quot;? &lt;br&gt;&lt;br&gt;, b, and i?

krystof wrote:
Oh alright Triumph. I do not agree with George Bush but I think America has plenty of money to throw around. Heh heh.

...and thank you for the excellent references, FirstReflex... Laughing out loud Laughing out loud Laughing out loud Laughing out loud Laughing out loud Laughing out loud Apologies, all around. Laughing out loud