www.webdeveloper.com
Results 1 to 5 of 5

Thread: Classes in CSS

  1. #1
    Join Date
    Jan 2008
    Location
    India
    Posts
    3

    Lightbulb Classes in CSS

    Hi all,

    We can use multiple classes for an element, i have a doubt is there any limitation for the count?

    E.g
    <div class="class1 class2 class3 ..... "></div>

    How many classes can be used for an element?

    Share Your Ideas....

    Jacob

  2. #2
    Join Date
    Mar 2007
    Posts
    63
    No idea. I thought you could just use as many as you wanted.

  3. #3
    Join Date
    Jan 2008
    Location
    India
    Posts
    3

    Lightbulb Can anyone Confirm..

    Hi,

    I think there is a limitation, if anyone knows please specify..


    Jacob

  4. #4
    Join Date
    Dec 2005
    Location
    American, living in Toronto, ON. CANADA
    Posts
    6,746
    No limitation, -so long as no declaration/selector over-rules another, previously-stated. Then, order-of-precidence takes 'hold and the last-stated is the obeyed.

    .first {color:red;....}
    .second {color:blue;....}
    .third {color:green;...}
    applied to:
    <h1 class="first second third">HEADER TEXT</h2>
    would be GREEN text, because the class "third" is stated last in the precedence order in the HTML..

    It gets complicated when you want some styles from class="first" and class="second" if you need "display:block;" and the second class states "display:inline;", and so forth...

    Myself, if more than TWO classes are needed, I combine the stated-needed Declarations and create another new class (like, class="four") and use solely that, instead of combining three potentially-conflicting classes.
    I build for: Firefox and tweak for IE

  5. #5
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    Within the confines of the syntax of HTML a class is just an attribute and I've never seen a character limit on an attribute value. If there are limits they are probably browser specific.
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles