1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.
  2. Better Analytics for WordPress Get It Free

Recomendation for multiple classes

Discussion in 'CSS' started by +:::Spider25:::+, May 13, 2006.

  1. #1
    Hi,
    This a question for using multiple classes for one tag. This is my tag

    <div class="Box Height720 Width562 FloatRight MarginLeft2">

    As seen I'm using 5 classes. Is this recommendable?, what other solution I have?
     
    +:::Spider25:::+, May 13, 2006 IP
  2. johneva

    johneva Well-Known Member

    Messages:
    1,429
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Well for starters I normally give divs an id instead if it is one of the main layout divs.

    I would advise making a class or id (What ever suites the job) that covers all the things you want doing for that element.

    But yeah you can do what you have done.
     
    johneva, May 13, 2006 IP
  3. Jyorraku

    Jyorraku Peon

    Messages:
    139
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Wow, I didn't even know you could do that... :-O
     
    Jyorraku, May 13, 2006 IP
  4. penagate

    penagate Guest

    Messages:
    277
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi,

    Although your method is perfectly valid, I would absolutely not recommend it. You're basically abusing the concept of using a stylesheet, by specifying layout-specific classes (such as Height720, FloatRight) in your (X)HTML document. But for one class ("Box") all of the ones you have used you might as well have specified using inline styles.

    A class and its name should relate to the type of content that the element holds. That type of content can then be styled accordingly (applying height, width, margin, float etc. properties) using whatever stylesheet you apply to the document.

    - P
     
    penagate, May 15, 2006 IP