C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers

114 comments

10,705 users

How Associating Headers with Cells?

0 votes
18 views
asked Apr 23, 2014 by smith Geek (15,340 points)

1 Answer

0 votes
The headers attribute from td and th elements can be used to make tables easier to process with screen readers. The value of the headers attribute is the ID attribute value of one or more th cells.
 
<!DOCTYPE HTML> 
<html> 
<head> 
<style> 
thead th{ text-align:left; background:grey; color:white} 
tbody th { text-align:right; background: lightgrey; color:grey} 
</style> 
</head> 
<body> 
    <table> 
        <thead> 
            <tr> 
               <th id="rank">Rank</th><th id="name">Name</th><th id="color">Color</th> 
            </tr> 
        </thead> 
        <tbody> 
            <tr> 
                <th id="first" headers="rank">Favorite:</th><td headers="name first">Mango</td><td headers="color first">Yellow</td> 
            </tr> 
        <tr> 
            <th id="second" headers="rank">2nd Favorite:</th><td headers="name second">Oranges</td><td headers="color second">Orange</td> 
        </tr> 
        </tbody> 
    </table> 
</body> 
</html>
 
answered Apr 23, 2014 by augustaina Sr Member (4,820 points)

Related questions

0 votes
1 answer 11 views
11 views asked Apr 11, 2014 by sunny Expert (11,410 points)
0 votes
1 answer 15 views
15 views asked Apr 19, 2014 by rock Expert (14,990 points)
0 votes
1 answer 13 views
13 views asked Apr 16, 2014 by omari Sr Member (3,860 points)
0 votes
1 answer 17 views
17 views asked Apr 14, 2014 by tin cook
0 votes
1 answer 57 views
57 views asked Apr 11, 2014 by omari Sr Member (3,860 points)
...