How are the `colspan` and `rowspan` attributes different?

Yes, yes. Functionally, they are different. But heck if I didn’t know about the wacky thresholds until Jens Oliver Meiert tooted a pair of quick polls.

According to the HTML Standard:

  1. If the current cell has a colspan attribute, then 


How are the `colspan` and `rowspan` attributes different? originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.


This content originally appeared on CSS-Tricks and was authored by Geoff Graham

Yes, yes. Functionally, they are different. But heck if I didn’t know about the wacky thresholds until Jens Oliver Meiert tooted a pair of quick polls.

According to the HTML Standard:

  1. If the current cell has a colspan attribute, then parse that attribute’s value, and let colspan be the result.
    If parsing that value failed, or returned zero, or if the attribute is absent, then let colspan be 1, instead.
    If colspan is greater than 1000, let it be 1000 instead.
  2. If the current cell has a rowspan attribute, then parse that attribute’s value, and let rowspan be the result.
    If parsing that value failed or if the attribute is absent, then let rowspan be 1, instead.
    If rowspan is greater than 65534, let it be 65534 instead.

I saw the answers in advance and know I’d have flubbed rowspan. Apparently, 1000 table columns are plenty of columns to span at once, while 65534 is the magic number for clamping how many rows we can span at a time. Why is the sweet spot for rowspan 6,4543 spans greater than colspan? There are usually good reasons for these things.

What that reason is, darned if I know, but now I have a little nugget for cocktail chatter in my back pocket.


How are the `colspan` and `rowspan` attributes different? originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.


This content originally appeared on CSS-Tricks and was authored by Geoff Graham


Print Share Comment Cite Upload Translate Updates
APA

Geoff Graham | Sciencx (2024-08-15T13:10:58+00:00) How are the `colspan` and `rowspan` attributes different?. Retrieved from https://www.scien.cx/2024/08/15/how-are-the-colspan-and-rowspan-attributes-different/

MLA
" » How are the `colspan` and `rowspan` attributes different?." Geoff Graham | Sciencx - Thursday August 15, 2024, https://www.scien.cx/2024/08/15/how-are-the-colspan-and-rowspan-attributes-different/
HARVARD
Geoff Graham | Sciencx Thursday August 15, 2024 » How are the `colspan` and `rowspan` attributes different?., viewed ,<https://www.scien.cx/2024/08/15/how-are-the-colspan-and-rowspan-attributes-different/>
VANCOUVER
Geoff Graham | Sciencx - » How are the `colspan` and `rowspan` attributes different?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/08/15/how-are-the-colspan-and-rowspan-attributes-different/
CHICAGO
" » How are the `colspan` and `rowspan` attributes different?." Geoff Graham | Sciencx - Accessed . https://www.scien.cx/2024/08/15/how-are-the-colspan-and-rowspan-attributes-different/
IEEE
" » How are the `colspan` and `rowspan` attributes different?." Geoff Graham | Sciencx [Online]. Available: https://www.scien.cx/2024/08/15/how-are-the-colspan-and-rowspan-attributes-different/. [Accessed: ]
rf:citation
» How are the `colspan` and `rowspan` attributes different? | Geoff Graham | Sciencx | https://www.scien.cx/2024/08/15/how-are-the-colspan-and-rowspan-attributes-different/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.