473,387 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Span Class

Dan
Newbie question...

Is it better coding to use <span class=bold>...</span> around text to
which I want to apply an inline bold style rather than <b>... </b> ?

If so, why?

Mar 2 '06 #1
11 3857
On Thu, 02 Mar 2006 19:45:03 +0100, Dan <te*******@gmail.com> wrote:

Maybe you already know, but before discussing any further: are you
familiar with the contents of
<URL:http://www.safalra.com/special/googlegroupsreply/> Please take note
of that bit. Thanks, now to your question:
Newbie question...
That's okay, we all started out that way. :-)
Is it better coding to use <span class=bold>...</span> around text to
which I want to apply an inline bold style rather than <b>... </b> ?

If so, why?


See, you ask the very good questions. You want to know why :-)

Well, before puting anything around text to which you want to apply an
inline bold style, ask yourself why you want to do that? If it is to give
the bit emphasis, there are two ways to accomplish that:

<p>If you want <em>this part to have emphasis</em>, you just gave it that.
If you want <strong>stronger emphasis</stronger>, this is what to use.</p>

In many graphical browsers emphasis gets rendered italic and strong
emphasis gets rendered bold.
See also <URL:http://www.w3.org/TR/html401/struct/text.html#edef-EM> for
other inline elements that give meaning to a bit of text. There's bound to
be one or two you could use for your purposes.

And if it renderes differently from what you need, well, that's where the
stylesheets come in (see, back on topic for this group). With a simple

em {
font-style:normal;
font-weight:bold; }

or

strong {
font-style:italic;
font-weight:normal; }

you can reverse the standard rendering of those two :-) Think of what else
you can do that way.

So, in short: first know the why, the very question you ask. Why do you
want a specific piece of text to stand out, to be different. Mark it up as
such, and let CSS take care of the looks for you.
--
______PretLetters:
| weblog | http://www.pretletters.net/weblog/weblog.html |
| webontwerp | http://www.pretletters.net/html/webontwerp.html |
|zweefvliegen | http://www.pretletters.net/html/vliegen.html |
Mar 2 '06 #2
Dan

Barbara de Zoete wrote:
On Thu, 02 Mar 2006 19:45:03 +0100, Dan <te*******@gmail.com> wrote:

Maybe you already know, but before discussing any further: are you
familiar with the contents of
<URL:http://www.safalra.com/special/googlegroupsreply/> Please take note
of that bit. Thanks, now to your question:

Well, before puting anything around text to which you want to apply an
inline bold style, ask yourself why you want to do that? If it is to give
the bit emphasis, there are two ways to accomplish that:
Thanks for asking. Yes, my purpose in this case is to emphasize text.

<p>If you want <em>this part to have emphasis</em>, you just gave it that.
If you want <strong>stronger emphasis</stronger>, this is what to use.</p>

In many graphical browsers emphasis gets rendered italic and strong
emphasis gets rendered bold.
See also <URL:http://www.w3.org/TR/html401/struct/text.html#edef-EM> for
other inline elements that give meaning to a bit of text. There's bound to
be one or two you could use for your purposes.

And if it renderes differently from what you need, well, that's where the
stylesheets come in (see, back on topic for this group). With a simple

em {
font-style:normal;
font-weight:bold; }

or

strong {
font-style:italic;
font-weight:normal; }

you can reverse the standard rendering of those two :-) Think of what else
you can do that way.


Thanks so much. This is extremely informative. Also, I assume I should
use <em> and <strong> over <i> and <b> because the latter tags are not
necessarily compatible with speech readers? Are <b> and <i> tags
actually deprecated though?

Thanks again,
Dan

Mar 2 '06 #3
Dan

Barbara de Zoete wrote:
On Thu, 02 Mar 2006 19:45:03 +0100, Dan <te*******@gmail.com> wrote:

Maybe you already know, but before discussing any further: are you
familiar with the contents of
<URL:http://www.safalra.com/special/googlegroupsreply/> Please take note
of that bit. Thanks, now to your question:

Well, before puting anything around text to which you want to apply an
inline bold style, ask yourself why you want to do that? If it is to give
the bit emphasis, there are two ways to accomplish that:
Thanks for asking. Yes, my purpose in this case is to emphasize text.

<p>If you want <em>this part to have emphasis</em>, you just gave it that.
If you want <strong>stronger emphasis</stronger>, this is what to use.</p> .... em {
font-style:normal;
font-weight:bold; }

or

strong {
font-style:italic;
font-weight:normal; }

you can reverse the standard rendering of those two :-) Think of what else
you can do that way.


Thanks so much. This is extremely informative. Also, I assume I should
use <em> and <strong> over <i> and <b> because the latter tags are not
necessarily compatible with speech readers? Are <b> and <i> tags
actually deprecated though?

Thanks again,
Dan

Mar 2 '06 #4
Dan <te*******@gmail.com> wrote:
Also, I assume I should use <em> and <strong> over <i> and <b> because
the latter tags are not necessarily compatible with speech readers?
If the text is emphasized or strongly emphasized, then use the EM or STRONG
elements. If there is some other reason to use italics or boldface, then
use something other than EM or STRONG.

Sometimes the I and B elements are the most appropriate markup. Examples
can be found at http://www.htmlhelp.com/reference/ht...ntstyle/i.html
and http://www.htmlhelp.com/reference/ht...ntstyle/b.html
Are <b> and <i> tags actually deprecated though?


No, not at all.
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"I can take one day at a time, but sometimes several days attack me at once."
Mar 2 '06 #5
On Thu, 02 Mar 2006 20:16:55 +0100, Dan <te*******@gmail.com> wrote:
Barbara de Zoete wrote:
On Thu, 02 Mar 2006 19:45:03 +0100, Dan <te*******@gmail.com> wrote:

Well, before puting anything around text to which you want to apply an
inline bold style, ask yourself why you want to do that? If it is to
give
the bit emphasis, there are two ways to accomplish that:
Thanks for asking. Yes, my purpose in this case is to emphasize text.


[ on using <em> and <stong> combined with CSS to set styles if needed ]
Thanks so much. This is extremely informative. Also, I assume I should
use <em> and <strong> over <i> and <b> because the latter tags are not
necessarily compatible with speech readers?
To be honest with you, I don't know what screen readers, aural browsers
and the like, do with em, strong, i or b. For me it has to do more with
the way I think. I like to make clear what the stuff is I put in my pages.
Clear for anything and anyone that asks for their contents. I 'think
structure and semantics'. I'm not sure when that started to happen :-)
Are <b> and <i> tags
actually deprecated though?


Depends on what doctype you intend to use, but if you stick with
HTML4.01Strict, no, not even with that doctype they are IIRC. See
<URL:http://www.w3.org/TR/html401/index/elements.html> to find out which
elements are and are not.
--
______PretLetters:
| weblog | http://www.pretletters.net/weblog/weblog.html |
| webontwerp | http://www.pretletters.net/html/webontwerp.html |
|zweefvliegen | http://www.pretletters.net/html/vliegen.html |
Mar 2 '06 #6
On 2 Mar 2006 11:17:58 -0800, "Dan" <te*******@gmail.com> wrote:
Thanks so much. This is extremely informative. Also, I assume I should
use <em> and <strong> over <i> and <b> because the latter tags are not
necessarily compatible with speech readers? Are <b> and <i> tags
actually deprecated though?


No. A good use of <i> is for matters such as names of ships and
scientific names of animals, which are normally italicised in print, but
the italics do not in this case imply emphasis.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Mar 2 '06 #7
Dan wrote:
Newbie question...

Is it better coding to use <span class=bold>...</span> around text to
which I want to apply an inline bold style rather than <b>... </b> ?

If so, why?


http://www.w3.org/TR/html4/present/graphics.html#h-15.2

15.2 Fonts
The following HTML elements specify font information. Although they are
not all deprecated, *their use is discouraged in favor of style sheets*.

15.2.1 Font style elements: the TT, I, B, BIG, SMALL, STRIKE, S, and U
elements

--
Gus

Mar 2 '06 #8
Dan wrote:
Newbie question...

Is it better coding to use <span class=bold>...</span> around text to
which I want to apply an inline bold style rather than <b>... </b> ?

If so, why?


The question you should ask yourself is 'why bold'? Take that answer,
scrunch it into a word or two, and make that the class name.

If you use <b>, then that text will always and forever be bold.
If you use <span class="bold">, you can style the text any way you like,
but if you later style it as something else, like italic, the class name
will no longer match the styling and you will become confused.
If you use <span class="thereasonIwantedtostylethis">, then you can
style it any way you want and change your mind later without befuddling
yourself.

Net: Assign class names based on semantics, then style the class as you
like.

Chris Beall

Mar 3 '06 #9
Also sprach Stephen Poley:
A good use of <i> is for matters such as names of ships and
scientific names of animals, which are normally italicised in print,
but the italics do not in this case imply emphasis.


I thought that's what <cite> was for:
http://www.htmlhelp.com/reference/ht...rase/cite.html
Mar 6 '06 #10
"Thomas Mlynarczyk" <bl*************@hotmail.com> wrote:
Also sprach Stephen Poley:
A good use of <i> is for matters such as names of ships and
scientific names of animals, which are normally italicised in print,
but the italics do not in this case imply emphasis.


I thought that's what <cite> was for:
http://www.htmlhelp.com/reference/ht...rase/cite.html


Where did the idea that ship names are classed as citations come from?
It doesn't seem at all logical to me.

http://www.w3.org/TR/html401/struct/text.html#edef-CITE
"Contains a citation or a reference to other sources."

Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Mar 6 '06 #11
On Mon, 6 Mar 2006, Thomas Mlynarczyk wrote:
Also sprach Stephen Poley:
A good use of <i> is for matters such as names of ships and
scientific names of animals, which are normally italicised in print,
but the italics do not in this case imply emphasis.


I thought that's what <cite> was for:
http://www.htmlhelp.com/reference/ht...rase/cite.html


Oh dear, typical muddle from the W3C. "Since CITE is a structural
element, it carries meaning". So: isn't it important to stick to that
meaning?

They suggest in their rambling text that CITE could be used for the
names of ships, and then they give an example of it being used *for
the name of a movie*, which just happens to be "Titanic". I'd have to
accuse whoever wrote that rambling text of making a category error,
right there.

I'd say the latter usage *is* appropriate (it really is a citation -
to a *movie*, which in this case just happens to be named for a
particular ship); I can't see anything in the dictionary - whether
from general usage or from technical usage - which would even remotely
justify calling the name of a ship a "citation". YMMV and IMHO.

At least they've given no suggestion of (mis)using it to mark up a
genus or species name. For which I'd follow Stephen Poley's advice,
and use <i> as the HTML markup, with a plausibly-chosen class name to
distinguish it (class="genus" or class="species" etc.).
Mar 6 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alexander Ross | last post by:
I have an html snippet, and I want to remove any <span> tags that have a specific attribute (class=none) ex. The quick brown <span class="animal">fox</span> jumped <span...
5
by: Kathryn | last post by:
Good morning! I am having a problem with a span. I have items, of which I only want to show the first X characters on the screen. If the user prints the page, I want the entire item to print....
6
by: Christopher Benson-Manica | last post by:
http://ataru.gomen.org/files/html/files/test.html: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Test page</title> <style...
6
by: hsomob1999 | last post by:
so i have a <ul> and I allow the user to append items to it. The problem is that on mozilla the <span class="line"> which is just a line to divide the sections gets overlaped and doesnt move down...
2
by: Alex | last post by:
On my page I have a lot string like this: <span onmouseover="callMe(this)" onmouseout="callMe(null)" >abc1</span> <span onmouseover="callMe(this)" onmouseout="callMe(null)" >abc2</span> <span...
5
by: ste.paoletti | last post by:
I have a problem with css I have a this xhtml code: <span> <span> <span/> <input type="radio"/> .... <span/> <input type="button" onclick ="var s=document.createElement('span');...
26
by: johkar | last post by:
I need to cancel the link and execute a function onclick of all the links within the span tag which has a class of "container" assigned. There will be only one span tag with this class applied. ...
4
by: Paul Lautman | last post by:
Within a subsection of an HTML document (not a complete page), there will be a few spans with the class "room_headings" e.g. <span class="room_headings" Double Room</span> Can folks...
5
by: David Housman | last post by:
Hello, I'm trying to implement a navigation bar with a ul in css. The code is a template, but i'm customizing. I can handle just text in each block, but i want the first block to have an image...
5
by: Brent | last post by:
Take this small HTML fragment: span.theClass{float:left;width:100px;cursor:pointer;cursor:hand;} ------------------------ <div> <span id="1" class="theClass">&nbsp;<span> <span id="2"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.