473,545 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can you do Class="multiple classes"?

I have inherited some CSS from a former employee that has code like
this:

onmouseover="th is.className='h ighlight_on standard_border '"

where it appears to activate two different classes, "highlight_ on" and
"standard_borde r".

Is this valid CSS?

If it is, is there a limit to how many classes you can apply? Any
other comments on this, or things I should know relating to it?

Thank you,
Ann

Jan 30 '06 #1
3 1832
Giggle Girl wrote:
I have inherited some CSS from a former employee that has code like
this:

onmouseover="th is.className='h ighlight_on standard_border '"

where it appears to activate two different classes, "highlight_ on" and
"standard_borde r".

Is this valid CSS?


See <http://www.w3.org/TR/html4/struct/global.html#ade f-class>:

class = cdata-list [CS]
This attribute assigns a class name or set of class names to an
element. Any number of elements may be assigned the same class name or
names. Multiple class names must be separated by white space characters.

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Jan 30 '06 #2
"Giggle Girl" <mi*******@gmai l.com> wrote:
I have inherited some CSS from a former employee that has code like
this:

onmouseover="th is.className='h ighlight_on standard_border '"
The code is just as foolish as it looks like. This illustrates well why class
names should describe the meaning (semantics) of elements rather than their
casual appearance.

The reason for using JavaScript here is probably the fact that IE does not
support the :hover pseudoelement except for links. But that's not a reason
for using foolish class names. Besides, _is_ this a non-link element? As
usual, the URL etc. etc.
where it appears to activate two different classes, "highlight_ on" and
"standard_borde r".
It activates nothing. It assigns two classes to the element.

Most probably, things could have been written better by using a single class,
say "hovered", and setting what you like to set for it. However, it's usually
non-productive to try to fix sloppy code.
Is this valid CSS?
Technically, it's not CSS. There is no CSS construct in the code snippet. But
class="highligh t_on standard_border " would be valid (though foolish) HTML,
and JavaScript lets you assign two classes that way, too.
If it is, is there a limit to how many classes you can apply?
Hardly.
Any other comments on this, or things I should know relating to it?


Let it be unless it causes real trouble. Don't imitate it.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jan 30 '06 #3
Thank you Johannes and Yucca for your response.

Very helpfull and informitive.

Ann

Jan 30 '06 #4

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

Similar topics

1
5657
by: Peter King | last post by:
if you assign multiple classes in order to keep your classes generic e.g ..classA { position.absolute; left:5 top:5 height:200 width:800 } ..classB { background-color: red} ..classC { background-color: green} <div id="div1" class="classA classB" ... but then want to dynamically assign a new class
32
3353
by: Will Hartung | last post by:
Can someone clarify that multiple classes in the "class" attribute are ok and "legal" and not some fluke? So, I can do: ..pink {color: pink} ..bold {font-weight: bold} ..medium {font-size: 12pt} <p class="bold pink medium">bold pink medium sized text</p>
3
3745
by: jwayne | last post by:
I'm trying to implement a navigation bar with multiple a href classes. The following example works exactly as I want it to, but for Internet Explorer only. Firefox does not indent each link. http://jonathanwayne.com/test/test.html Here's the relevant snippet: <div class="nav"> <a href="#">link 0</a>
9
2503
by: Gomaw Beoyr | last post by:
Two question about the "partial classes" (in the next wersion of ..NET). Question 1 ========== Will partial classes (in the next version of C#) have to be declared "partial" in ALL places. I.e. do we have to need to write:
5
1767
by: farmer | last post by:
I need "include" multiple classes from multiple files such as: <%@ Page Language="C#" Debug="true" ValidateRequest="false" Src="~/Auth/Pub/Auth.cs"%> <%@ Page Language="C#" Debug="true" ValidateRequest="false" Src="~/Edit/Item.cs"%> But the compile says can't use more than one "@Page" directive. Or,I need to "include" another class from...
5
1947
by: Rob | last post by:
In many articles related to VB.net the word "class" is used... How many meanings are there to this word ? "possible to derived a class from another" "forms are full-fledged classes" "base class"
11
41057
by: Kimmo Laine | last post by:
I'm flipping my wig here, people. I'm using classes and making each class a file. when I'm including dependet classess, I use require_once to avoid multiple declarations - yet they happen. I put debug_print_backtrace in the file to see how it is included, and here's the output: #0 require_once() called at #1 ...
0
7499
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7689
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7943
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7456
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7786
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1919
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.