SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Thread: Tables In CSS?

  1. #1
    Wishful Thinking webmasternovis's Avatar
    Join Date
    Jul 2002
    Location
    England
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Tables In CSS?

    Hi guys,

    I want to make a sorta table thing in CSS? I know how to do this, but not so that when you lay your mouse on one cell in a row - the whole row changes to whatever you set 'hover' to...

    Could anyone help please?

    Mike

  2. #2
    SitePoint Enthusiast vischo's Avatar
    Join Date
    Mar 2003
    Location
    Chicago, IL
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You want to make a row change color onmouseover? Or you want to make only the cell?

  3. #3
    SitePoint Enthusiast blakems's Avatar
    Join Date
    Oct 2002
    Location
    Utah
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you will have to use javascript to make the whole row change color. You can do it for individual cells though.
    blakems.com
    "reaching more of your brain cells"


  4. #4
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, not necessarily. if you have a big div that acts like a row, and contains individual divs as cells, you can most probably have a :hover behaviour on the big div itself...
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  5. #5
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Some CSS2 will solve your problem:
    Code:
    tr:hover {
      /*rules here*/
    }
    NS6+ and Opera only though.

    Remember, if you need a table in XHTML (for tabular data), then USE A TABLE. XHTML is not about doing everything without tables; rather, it's about using elements for their intended purpose and giving your markup some structure.

  6. #6
    SitePoint Enthusiast blakems's Avatar
    Join Date
    Oct 2002
    Location
    Utah
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh great, so the only way to do it is in a table is to wait until IE 7.0(in ten years) or put it in divs which may it may not work as intended if I have tabular content.
    blakems.com
    "reaching more of your brain cells"


  7. #7
    SitePoint Addict
    Join Date
    Dec 2002
    Posts
    386
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it sounds like a fairly non-critical feature. Why not put it in there for the uptodate browsers, and let the older browsers just do without. That way no-one loses but some people gain...
    or you could use js, but then of course you are opening yourself up to a whole new load of issues

  8. #8
    Life is short. Be happy today! silver trophybronze trophy Sagewing's Avatar
    Join Date
    Apr 2003
    Location
    Denver, Phang-Nga, Thailand
    Posts
    4,379
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cant you put a class into the tr and have it cause a hover effect for the whole row? i thought that was possible ?!
    The fewer our wants, the nearer we resemble the gods. — Socrates

    SAGEWING LLC - QUALITY WEB AND MOBILE APPS. PREMIUM OUTSOURCING SERVICES.
    Twitter | LinkedIn | Facebook | Google+

  9. #9
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dhecker
    cant you put a class into the tr and have it cause a hover effect for the whole row? i thought that was possible ?!
    only impossible if you're using IE...as it doesn't understand hover on anything except links (last time i checked, anyway). more CSS compliant browsers accept pseudo classes such as :hover on any element...
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  10. #10
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by redux
    only impossible if you're using IE...as it doesn't understand hover on anything except links (last time i checked, anyway). more CSS compliant browsers accept pseudo classes such as :hover on any element...
    Exactly. In a site I'm working on now, I just use a "tr:hover" rule to change the background color of a row for CSS2-aware browsers, but IE doesn't miss much when the hover effect doesn't happen. That's the beauty of CSS2 (and CSS and XHTML too): it degrades gracefully.


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
  •