This was interesting

L

Lewis

I was looking at some page source toady and I came across this:

<div class="bar group">

Pretty sure I've never seen that, so I did a little testing at it
appears to apply both the .bar and .group styles to the div, but I have
to wonder, WHY?

Is this common? I'm trying to wrap my head around why you'd want to do
this this way and I'm not coming up with a lot.

..red { color: red; }

class="style1 red"

is about the only thing I can think of where it seems like it might make
sense (not that specifically, but that sort of thing).

I did look, briefly, at the CSS and both bar and group were rather
complicated, and shared a lot of the identical css settings, so I'm not
sure what the point was.
 
J

Jukka K. Korpela

Lewis said:
I was looking at some page source toady and I came across this:

<div class="bar group">

Pretty sure I've never seen that,

It's actually rather common to have multiple classes listed in a class
attribute, especially since Netscape 4 (which didn't grok such constructs)
virtually died.

By the way, "This was interesting" was about the most uninteresting heading
you can write. I wouldn't have looked at the message if they didn't pay me
for reading alt.html. Oh wait... what are you saying? The _don't_ pay me?
D'Oh!
so I did a little testing at it
appears to apply both the .bar and .group styles to the div, but I
have to wonder, WHY?

Because that's what the specifications say.
Is this common?

Rather common, especially when CSS is used in a relatively advanced way.
I'm trying to wrap my head around why you'd want to do
this this way and I'm not coming up with a lot.

.red { color: red; }

class="style1 red"

Not along those lines for sure. To begin with, the name "style1" says
virtually nothing, and "red" is worse because it easily gets misleading
(when, say, someone decides to render warnings not in red but in some other
prominent way). And without anything declared for "style1" anywhere, it's
presence is pointless.

For example, suppose that you have a table where some cells contain numeric
data (and should therefore be right-aligned) and some cells are to be
highlighted, you might have CSS rules like

..numeric { text-align: right; }
..highlight { background: #ffd; color: black; }

And when you have a cell that contains numeric data _and_ should be
highlighted... what would you do in HTML markup?

Yes, you would use <td class="numeric highlight">42</td>.
 
1

123Jim

Lewis said:
I was looking at some page source toady and I came across this:

<div class="bar group">

Pretty sure I've never seen that, so I did a little testing at it
appears to apply both the .bar and .group styles to the div, but I have
to wonder, WHY?

Is this common? I'm trying to wrap my head around why you'd want to do
this this way and I'm not coming up with a lot.

.red { color: red; }

class="style1 red"

is about the only thing I can think of where it seems like it might make
sense (not that specifically, but that sort of thing).

I did look, briefly, at the CSS and both bar and group were rather
complicated, and shared a lot of the identical css settings, so I'm not
sure what the point was.

--

http://webdesign.about.com/od/css/qt/tipcssmulticlas.htm
"One of the lesser known tricks with CSS is the fact that you don't have to
limit your elements to just one class. If you need to set multiple classes
on an element, you add them simply by separating them with a space in your
attribute."

I can see it being useful for something.
 
D

Denis McMahon

I was looking at some page source toady and I came across this:

<div class="bar group">

Pretty sure I've never seen that, so I did a little testing at it
appears to apply both the .bar and .group styles to the div, but I have
to wonder, WHY?

Is this common? I'm trying to wrap my head around why you'd want to do
this this way and I'm not coming up with a lot.

.red { color: red; }

class="style1 red"

is about the only thing I can think of where it seems like it might make
sense (not that specifically, but that sort of thing).

I did look, briefly, at the CSS and both bar and group were rather
complicated, and shared a lot of the identical css settings, so I'm not
sure what the point was.

well:

<span class="left"><span class="red"><span class="italic"><a href
class="linkstyle"
href="http://www.example.com">example.com</a></span></span></span>

vs:

<a href class="linkstyle red left italic"
href="http://www.example.com">example.com</a>

Of course, you could create:

leftredbold
leftreditalic
leftredbolditalic

etc ......

but it might be more efficient to just create a set of colours, a set of
font effects, a set of aligns and combine them in the class attribute.

Rgds

Denis McMahon
 
R

richard

It's actually rather common to have multiple classes listed in a class
attribute, especially since Netscape 4 (which didn't grok such constructs)
virtually died.

By the way, "This was interesting" was about the most uninteresting heading
you can write. I wouldn't have looked at the message if they didn't pay me
for reading alt.html. Oh wait... what are you saying? The _don't_ pay me?
D'Oh!


Because that's what the specifications say.


Rather common, especially when CSS is used in a relatively advanced way.


Not along those lines for sure. To begin with, the name "style1" says
virtually nothing, and "red" is worse because it easily gets misleading
(when, say, someone decides to render warnings not in red but in some other
prominent way). And without anything declared for "style1" anywhere, it's
presence is pointless.

For example, suppose that you have a table where some cells contain numeric
data (and should therefore be right-aligned) and some cells are to be
highlighted, you might have CSS rules like

.numeric { text-align: right; }
.highlight { background: #ffd; color: black; }

And when you have a cell that contains numeric data _and_ should be
highlighted... what would you do in HTML markup?

Yes, you would use <td class="numeric highlight">42</td>.

look dickhead, I don't write my style sheets to appease your specific
tastes. If I want to use "red" that's my damn business.
however, I do try to avoid using class names that equal specific elements.
So instead of "red" I would use maybe "ared".
 
B

Beauregard T. Shagnasty

richard said:
look dickhead,

That should have been, "Thanks for the good information, dickhead."
If I want to use "red" that's my damn business.

Since it is "your damn business," why do you even bother to ask for
advice -- which you almost never accept. Or if you do, you never show
any appreciation for it.

Sincerely, why ask?
 
B

Beauregard T. Shagnasty

Sherm said:
It's called "trolling."

Honestly, B. - haven't you been here long enough to recognize the
signs by now?

I don't really think it is. Srsly, RtS isn't smart enough to troll.
 
D

dorayme

richard said:
If I want to use "red" that's my damn business.
however, I do try to avoid using class names that equal specific elements.
So instead of "red" I would use maybe "ared".

Why not "red"? I mean, given it is your damn business! <g>
 
N

Norman Peelman

richard said:
look dickhead, I don't write my style sheets to appease your specific
tastes. If I want to use "red" that's my damn business.
however, I do try to avoid using class names that equal specific elements.
So instead of "red" I would use maybe "ared".

Oh, now that's funny... a guy named Richard calling someone a 'dickhead'.
 
B

Beauregard T. Shagnasty

Ed said:
Perhaps that's the mark of a really really good troll?

Sometimes, but not in the case of RtS. You're probably not as familiar
with him over the years as some of us.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top