SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Location
    Pacific NW
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    css - duplicate property values?

    In css, can an item be declared more than once? Example:

    Code:
    td.cat,td.catHead,td.catSides,td.catLeft,td.catRight,td.catBottom {
    background-color:#0099CC;
    border: #FFFFFF;
    border-style: solid;
    height: 28px;}
    Code:
    td.cat,td.catHead,td.catBottom {
    height: 29px;
    border-width: 0px 0px 0px 0px; }
    The properties in the bottom example are in the first example. You'll notice there are 2 different height values. This doesn't seem right to me... how does it decide which one to use?

  2. #2
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It goes by the last one declared. :-)

    ~~Ian

  3. #3
    Fully Sweet Car noddy's Avatar
    Join Date
    Aug 2002
    Location
    Perth, Western Australia
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ian Glass
    It goes by the last one declared. :-)

    ~~Ian
    but if you reverse the order you may keep the same propties but if their are conflicting properties it will use the last one. You could make up a new class for the differance.

    What is it you are trying to change?

  4. #4
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Location
    Pacific NW
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by noddy
    but if you reverse the order you may keep the same propties but if their are conflicting properties it will use the last one. You could make up a new class for the differance.

    What is it you are trying to change?
    It's from phpBB's default css... looks like I've got a bit of cleaning up to do.
    Thanks for the responses.

  5. #5
    SitePoint Addict
    Join Date
    Jul 2001
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by noddy
    if their are conflicting properties it will use the last one.
    i agree.
    thats the ticket in using css. c is cascading.
    in the examples from the first post...
    the first code sets that style to all of those elements probably being a common style they like.
    the second code sets a bit more specific style on parts on some of the same elements.
    if the same property is declared, such as the height in this case, then the newest value will be used. if a new property is declared, it will be "added on" to the current styles for the elements.
    those two code snippits look fine to use. although they could have shortened the last line to...
    border-width: 0px;

  6. #6
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Location
    Pacific NW
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, makes sense now.

  7. #7
    Fully Sweet Car noddy's Avatar
    Join Date
    Aug 2002
    Location
    Perth, Western Australia
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by alda.b
    Thanks, makes sense now.
    thats what everyone is here for is to try make sense of things


Bookmarks

Posting Permissions

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