Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Jun 2004
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What is the CSS of equivalent of colspan and rowspan?

    What is the CSS of equivalent of colspan and rowspan?

    I tried row-span and col-span, but they don't work...

    Just curious.

  • #2
    Senior Coder chilipie's Avatar
    Join Date
    Jul 2004
    Location
    Shrewsbury, UK Age: 16
    Posts
    1,117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There isn't a CSS equivalent. If you think about it, the colspan and rowspan attributes make up the structure of the table, whereas CSS is for presentation, and HTML should be used for structural purposes.

    Ollie .

  • #3
    Regular Coder
    Join Date
    Mar 2005
    Location
    D0u$h!t3 k4?
    Posts
    512
    Thanks
    2
    Thanked 5 Times in 5 Posts
    I don't think the colspan and rowspan attributes will ever be removed. Although, a CSS3 Multi-Column Layout Module is currently available as a Working Draft (WD) in which a property known as 'column-span' is added, I don't believe that something like that will appear for a long time for tables.
    Last edited by rpgfan3233; 04-10-2005 at 02:39 PM.

  • #4
    New Coder
    Join Date
    Jun 2004
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Or better yet, how do I use CSS to span content into two table cells instead of just one table cell?

    Well, the the thing si, I was messing around with the CSS tablss model, and it works pretty much like a table, except that I cann't do the rowspan or colspan thing...
    Last edited by ampulator00; 04-10-2005 at 04:24 PM.

  • #5
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Quote Originally Posted by ampulator00
    Or better yet, how do I use CSS to span content into two table cells instead of just one table cell?
    You don't. It's just like Chilipie said-- tables are a way to structure content, CSS is a way to style content. If you're using a table you'd have to use the attributes of a table to get the data where it needs to be, by using rowspan and colspan.

    There's a CSS model for a table-like display; in other words, there are display settings (like display: table-cell) that give a block level element the behavior of a table element (in this case, a table cell). But that's one element at a time, not an entire table.

  • #6
    New Coder
    Join Date
    Jun 2004
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rmedek
    You don't. It's just like Chilipie said-- tables are a way to structure content, CSS is a way to style content. If you're using a table you'd have to use the attributes of a table to get the data where it needs to be, by using rowspan and colspan.

    There's a CSS model for a table-like display; in other words, there are display settings (like display: table-cell) that give a block level element the behavior of a table element (in this case, a table cell). But that's one element at a time, not an entire table.
    so... I know that, but how would make it longer using html then, with the CSS tables model?
    Last edited by ampulator00; 04-10-2005 at 08:33 PM.

  • #7
    Regular Coder
    Join Date
    Mar 2005
    Location
    D0u$h!t3 k4?
    Posts
    512
    Thanks
    2
    Thanked 5 Times in 5 Posts
    With a lot of unnecessary work. The only time you would want to use "display: table-cell" is when you would want to keep the contents a block-level element, but display it like an inline element (in the same "row"). The 'colspan' and 'rowspan' attributes have no direct CSS equivalents and can only be used for table elements. They CANNOT be used for elements that would emulate them, such as DIVs. If you want to create 'colspan' or 'rowspan' using CSS, you must use the 'height' and 'width' properties.

  • #8
    New Coder
    Join Date
    Jun 2004
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rpgfan3233
    With a lot of unnecessary work. The only time you would want to use "display: table-cell" is when you would want to keep the contents a block-level element, but display it like an inline element (in the same "row"). The 'colspan' and 'rowspan' attributes have no direct CSS equivalents and can only be used for table elements. They CANNOT be used for elements that would emulate them, such as DIVs. If you want to create 'colspan' or 'rowspan' using CSS, you must use the 'height' and 'width' properties.
    Thank you, for your suggestion.

    I think I have solution to my problem; instead of putting the content that needs to span 2 columns, I simply decided to put it outside, and the break the one CSS table into several, more manageable CSS tables, and each time I have new content that spans twice, I put it outside, and make a new CSS table. Is that fine?

  • #9
    Regular Coder
    Join Date
    Mar 2005
    Location
    D0u$h!t3 k4?
    Posts
    512
    Thanks
    2
    Thanked 5 Times in 5 Posts
    Why not just use 'colspan'? It isn't forbidden, deprecated, or anything like that.
    Even in the WD of XHTML2 (which is meant to be NOT backwards-compatible), those attributes are still there:
    http://www.w3.org/TR/xhtml2/mod-tables.html#sec_26.6.1.


  •  

    Posting Permissions

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