What's The Correct Scope Value To Use For An HTML Table Cell ...
Trang chủ » Html Colgroup Scope
» What's The Correct Scope Value To Use For An HTML
Table Cell ...
Có thể bạn quan tâm
-
- Home
- Questions
- Tags
- Users
- Companies
- Labs
- Jobs
- Discussions
- Collectives
-
Communities for your favorite technologies. Explore all Collectives
- Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Try Teams for free Explore Teams - Teams
-
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams Get early access and see previews of new features.
Learn more about Labs What’s the correct scope value to use for an HTML <th> table cell than spans several columns? Ask Question Asked 15 years, 6 months ago Modified 8 years, 2 months ago Viewed 9k times 7 Say you’ve got an HTML table, with a <th> cell that spans several columns, e.g.
<table> <tr> <th colspan="3" scope="?">Scores</th> <!-- ...more headings here... --> </tr> <tr> <th scope="col">English</th> <th scope="col">Maths</th> <th scope="col">Science</th> <!-- ...more sub-headings here... --> </tr> <tr> <td>12</td> <td>16</td> <td>20</td> <!-- ...more cells here... --> </tr> </table> What’s the correct value for the scope attribute for the spanning header cell? col seems incorrect as it’s heading several columns, but colgroup does’t seem right if I don’t actually have any colgroup tags.
- html
- html-table
- accessibility
Share Improve this question Follow edited Sep 25, 2016 at 16:17 Brian Tompsett - 汤莱恩 5,8757272 gold badges6161 silver badges133133 bronze badges asked Jun 7, 2009 at 19:37 Paul D. WaitePaul D. Waite 98.7k5757 gold badges202202 silver badges271271 bronze badges Add a comment | 3 Answers 3
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 9 The WebAIM (Web Accessibility in Mind) group has a great article on creating accessible data tables. Overall, they recommend avoiding spanned rows or columns, as screen readers cannot interpret the markup reliably.
Short of avoiding spanned columns altogether, I've had really good luck using the id/headers attributes in combination with the scope attribute. Although the markup is more verbose, this seems to simplify things for JAWS, and as a result it has less trouble interpreting the data.
This is what your example would look like with id/headers:
<table> <tr> <th id="scores" colspan="3">Scores</th> </tr> <tr> <th id="english" scope="col">English</th> <th id="maths" scope="col">Maths</th> <th id="science" scope="col">Science</th> </tr> <tr> <td headers="scores english">12</td> <td headers="scores maths">16</td> <td headers="scores science">20</td> </tr> </table> Share Improve this answer Follow answered Jun 9, 2009 at 21:35 Dave LockhartDave Lockhart 1,14111 gold badge1111 silver badges99 bronze badges 1 - 1 Great stuff, thanks. I’d lean on the side of the screen readers supporting the spec rather than everyone coding to their quirks, but it’s great to document the quirks. – Paul D. Waite Commented Jun 10, 2009 at 12:43
Add a comment | 5 According to the second example table in the HTML spec, it’s colgroup, despite the lack of colgroup tags.
http://www.w3.org/TR/html4/struct/tables.html#h-11.4.1
Share Improve this answer Follow answered Jun 7, 2009 at 19:38 Paul D. WaitePaul D. Waite 98.7k5757 gold badges202202 silver badges271271 bronze badges Add a comment | 1 Perhaps the caption feature may be better suited for you...
<table> <caption>Scores</caption> <thead> <tr> <th scope="col">English</th> <th scope="col">Maths</th> <th scope="col">Science</th> </tr> </thead> <tbody> <tr> <td>12</td> <td>16</td> <td>20</td> </tr> </tbody> </table> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption
Share Improve this answer Follow answered Dec 8, 2013 at 21:38 MetalAdamMetalAdam 57622 gold badges99 silver badges2828 bronze badges 2 - Ah — yes quite possibly. The actual use case I had in mind was a table with more columns than in my example HTML, so the heading that spans several columns didn’t actually span the entire table. I’ll amend the example accordingly. – Paul D. Waite Commented Dec 8, 2013 at 23:31
- 1 Gotcha. Dave's response in using the ID's seems to be exactly what you were looking for. You know, 4 years ago :) – MetalAdam Commented Dec 10, 2013 at 14:10
Add a comment | Your Answer
Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Draft saved Draft discarded Sign up or log in
Sign up using Google Sign up using Email and Password Submit Post as a guest
Name Email Required, but never shown
Post Your Answer Discard By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged - html
- html-table
- accessibility
or ask your own question.
- The Overflow Blog
- Why do developers love clean code but hate writing documentation?
- This developer tool is 40 years old: can it be improved?
- Featured on Meta
- The December 2024 Community Asks Sprint has been moved to March 2025 (and...
- Stack Overflow Jobs is expanding to more countries
Related
3 How to decide when to use <th> or when not? in <table> 3 HTML accessible tables - does th have to be the first column in a row? 2 Writing accurate <th> for accessible <table> 8 "id" and "headers" or "scope" for data table accessibility? 4 CSS style elements within <th> scope 5 Why use both <thead> and <th scope="col"> 3 HTML Table denoting non-data table cell 1 Table accessibility question for table elements question 0 one column table with multiple <th> 0 Accessibility issue with HTML table Hot Network Questions
- Convergence of a power series taking values on distributions
- Determine dropout spacing for vintage bike frame online
- C++ code reading from a text file, storing value in int, and outputting properly rounded float
- Errors while starting vite + react
- Factorization of maps between locally compact Hausdorff space
- Does silence have a role to play in the philosophical dialectic?
- What does the hypothesis "EPR=ER" claim?
- Suspension spectrum functor
- What keyboard shortcuts disable the keyboard?
- How feasible would it be to "kill" the Sun by using blood?
- How was fraud by false representation charged in this case?
- Why do many PhD application sites for US universities prevent recommenders from updating recommendation letters, even before the application deadline?
- Product of all binomial coefficients
- Why is Jesus called Prince of Peace and not King of Peace considering he was also called Eternal Father?
- MotW: Which bonuses stack?
- How is the associator defined in the Eilenberg-Moore category of a monoidal monad?
- Can a ship like Starship roll during re-entry?
- Removing Matching Pixels?
- Epistemic Concern Regarding Black Holes
- How to Mitigate Risks Before Delivering a Project with Limited Testing?
- What's wrong with my formal translation of "every positive number has exactly two square roots"?
- Tikz: Wrapping labels in a node on a tree
- Permanent night on a portion of a planet
- PSE Advent Calendar 2024 (Day 20): Holly
more hot questions Question feed Subscribe to RSS Question feed To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
lang-html
Từ khóa » Html Colgroup Scope
-
HTML | Scope Attribute - GeeksforGeeks
-
HTML Th Scope Attribute - W3Schools
-
Scope Of Headers | Tables | WAI Web Accessibility Tutorials - W3C
-
H63: Using The Scope Attribute To Associate Header Cells And ... - W3C
-
: The Table Column Group Element - MDN Web Docs
-
HTML | Scope Attribute - GeeksforGeeks
-
HTML Th Scope Attribute - Dofactory
-
COLGROUP - Table Column Group - HTML Help
-
HTML Td Scope Attribute
-
The Table Element - HTML Standard, Edition For Web Developers
-
Cells In A
Element That Use The Headers Attribute Must Only ...
-
CSS Scope, Colgroup> Tag In HTML, JavaScript Th Scope, Details ...
-
Colgroup - Table Column Group
-
HTML[th要素]見出しの対象範囲を指定する - TAG Index
Liên Hệ
TRUYỀN HÌNH CÁP SÔNG THU ĐÀ NẴNG
Địa Chỉ: 58 Hàm Nghi - Đà Nẵng
Phone: 0904961917
Facebook: https://fb.com/truyenhinhcapsongthu/
Twitter: @ Capsongthu
Copyright © 2022 | Thiết Kế Truyền Hình Cáp Sông Thu
Trang chủ » Html Colgroup Scope » What's The Correct Scope Value To Use For An HTML
Có thể bạn quan tâm
-
- Home
- Questions
- Tags
- Users
- Companies
- Labs
- Jobs
- Discussions
- Collectives
-
Communities for your favorite technologies. Explore all Collectives
- Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Try Teams for free Explore Teams - Teams
-
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsGet early access and see previews of new features.
Learn more about Labs What’s the correct scope value to use for an HTML <th> table cell than spans several columns? Ask Question Asked 15 years, 6 months ago Modified 8 years, 2 months ago Viewed 9k times 7Say you’ve got an HTML table, with a <th> cell that spans several columns, e.g.
<table> <tr> <th colspan="3" scope="?">Scores</th> <!-- ...more headings here... --> </tr> <tr> <th scope="col">English</th> <th scope="col">Maths</th> <th scope="col">Science</th> <!-- ...more sub-headings here... --> </tr> <tr> <td>12</td> <td>16</td> <td>20</td> <!-- ...more cells here... --> </tr> </table>What’s the correct value for the scope attribute for the spanning header cell? col seems incorrect as it’s heading several columns, but colgroup does’t seem right if I don’t actually have any colgroup tags.
- html
- html-table
- accessibility
3 Answers 3
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 9The WebAIM (Web Accessibility in Mind) group has a great article on creating accessible data tables. Overall, they recommend avoiding spanned rows or columns, as screen readers cannot interpret the markup reliably.
Short of avoiding spanned columns altogether, I've had really good luck using the id/headers attributes in combination with the scope attribute. Although the markup is more verbose, this seems to simplify things for JAWS, and as a result it has less trouble interpreting the data.
This is what your example would look like with id/headers:
<table> <tr> <th id="scores" colspan="3">Scores</th> </tr> <tr> <th id="english" scope="col">English</th> <th id="maths" scope="col">Maths</th> <th id="science" scope="col">Science</th> </tr> <tr> <td headers="scores english">12</td> <td headers="scores maths">16</td> <td headers="scores science">20</td> </tr> </table> Share Improve this answer Follow answered Jun 9, 2009 at 21:35 Dave LockhartDave Lockhart 1,14111 gold badge1111 silver badges99 bronze badges 1- 1 Great stuff, thanks. I’d lean on the side of the screen readers supporting the spec rather than everyone coding to their quirks, but it’s great to document the quirks. – Paul D. Waite Commented Jun 10, 2009 at 12:43
According to the second example table in the HTML spec, it’s colgroup, despite the lack of colgroup tags.
http://www.w3.org/TR/html4/struct/tables.html#h-11.4.1
Share Improve this answer Follow answered Jun 7, 2009 at 19:38 Paul D. WaitePaul D. Waite 98.7k5757 gold badges202202 silver badges271271 bronze badges Add a comment | 1Perhaps the caption feature may be better suited for you...
<table> <caption>Scores</caption> <thead> <tr> <th scope="col">English</th> <th scope="col">Maths</th> <th scope="col">Science</th> </tr> </thead> <tbody> <tr> <td>12</td> <td>16</td> <td>20</td> </tr> </tbody> </table>https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption
Share Improve this answer Follow answered Dec 8, 2013 at 21:38 MetalAdamMetalAdam 57622 gold badges99 silver badges2828 bronze badges 2- Ah — yes quite possibly. The actual use case I had in mind was a table with more columns than in my example HTML, so the heading that spans several columns didn’t actually span the entire table. I’ll amend the example accordingly. – Paul D. Waite Commented Dec 8, 2013 at 23:31
- 1 Gotcha. Dave's response in using the ID's seems to be exactly what you were looking for. You know, 4 years ago :) – MetalAdam Commented Dec 10, 2013 at 14:10
Your Answer
Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Draft saved Draft discardedSign up or log in
Sign up using Google Sign up using Email and Password SubmitPost as a guest
Name EmailRequired, but never shown
Post Your Answer DiscardBy clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged - html
- html-table
- accessibility
or ask your own question.
- The Overflow Blog
- Why do developers love clean code but hate writing documentation?
- This developer tool is 40 years old: can it be improved?
- Featured on Meta
- The December 2024 Community Asks Sprint has been moved to March 2025 (and...
- Stack Overflow Jobs is expanding to more countries
Related
3 How to decide when to use <th> or when not? in <table> 3 HTML accessible tables - does th have to be the first column in a row? 2 Writing accurate <th> for accessible <table> 8 "id" and "headers" or "scope" for data table accessibility? 4 CSS style elements within <th> scope 5 Why use both <thead> and <th scope="col"> 3 HTML Table denoting non-data table cell 1 Table accessibility question for table elements question 0 one column table with multiple <th> 0 Accessibility issue with HTML tableHot Network Questions
- Convergence of a power series taking values on distributions
- Determine dropout spacing for vintage bike frame online
- C++ code reading from a text file, storing value in int, and outputting properly rounded float
- Errors while starting vite + react
- Factorization of maps between locally compact Hausdorff space
- Does silence have a role to play in the philosophical dialectic?
- What does the hypothesis "EPR=ER" claim?
- Suspension spectrum functor
- What keyboard shortcuts disable the keyboard?
- How feasible would it be to "kill" the Sun by using blood?
- How was fraud by false representation charged in this case?
- Why do many PhD application sites for US universities prevent recommenders from updating recommendation letters, even before the application deadline?
- Product of all binomial coefficients
- Why is Jesus called Prince of Peace and not King of Peace considering he was also called Eternal Father?
- MotW: Which bonuses stack?
- How is the associator defined in the Eilenberg-Moore category of a monoidal monad?
- Can a ship like Starship roll during re-entry?
- Removing Matching Pixels?
- Epistemic Concern Regarding Black Holes
- How to Mitigate Risks Before Delivering a Project with Limited Testing?
- What's wrong with my formal translation of "every positive number has exactly two square roots"?
- Tikz: Wrapping labels in a node on a tree
- Permanent night on a portion of a planet
- PSE Advent Calendar 2024 (Day 20): Holly
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
lang-htmlTừ khóa » Html Colgroup Scope
-
HTML |
Scope Attribute - GeeksforGeeks HTML Th Scope Attribute - W3Schools
Scope Of Headers | Tables | WAI Web Accessibility Tutorials - W3C
H63: Using The Scope Attribute To Associate Header Cells And ... - W3C
: The Table Column Group Element - MDN Web Docs HTML |
Scope Attribute - GeeksforGeeks HTML Th Scope Attribute - Dofactory
COLGROUP - Table Column Group - HTML Help
HTML Td Scope Attribute
The Table Element - HTML Standard, Edition For Web Developers
Cells In A
Element That Use The Headers Attribute Must Only ...
CSS Scope, Colgroup> Tag In HTML, JavaScript Th Scope, Details ...
Colgroup - Table Column Group
HTML[th要素]見出しの対象範囲を指定する - TAG Index
Liên Hệ
TRUYỀN HÌNH CÁP SÔNG THU ĐÀ NẴNG
Địa Chỉ: 58 Hàm Nghi - Đà Nẵng
Phone: 0904961917
Facebook: https://fb.com/truyenhinhcapsongthu/
Twitter: @ Capsongthu
Copyright © 2022 | Thiết Kế Truyền Hình Cáp Sông Thu