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 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Table with first row bordered?

    Hi there

    COuld anybody advise me if this is possible. I would like to make a table that has first row bordered, but other rows not. I know it is possible using border in CSS and <th> and <tr> but the problem is then the first row is 2 pixels wider, because it has border and the others do not have border.

    The only trick I find is to make border around other rows also same colour as background on the table, so the border is seen as a background on the missing 2 pixels (when using border 1px. But since I have tables with many different backrounds it makes it impractical.

    Is there any easier way to do it using tables and CSS? And yes, I do need tables, as I use tabelar data :-)

    Yours

    Jernej

  • #2
    Regular Coder
    Join Date
    Apr 2006
    Posts
    231
    Thanks
    9
    Thanked 1 Time in 1 Post
    use height???

    I've never edited rows themselves, just cells. what I would do is make the tds in the first row so they fit your style.

    say you have 10 cells in the first row:
    1st td: border-left, border-top, border-bottom.
    2nd-9th td: border-top, border-bottom.
    10th td: border-right, border-top, border-bottom.

    The rest of the cells, just set the height on them and make it 2 bigger than the rest.

    Hard-coding, sure. works, sure.

  • #3
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,338
    Thanks
    29
    Thanked 282 Times in 276 Posts
    border-color: transparent is an option though that doesn't work in Internet Explorer 6.

    What you really need is probably the border-box model where the border is considered part of the width of the box. To access it you either need to use the proposed CSS 3 box-sizing: border-box declaration (Opera), a proprietary declaration like -moz-box-sizing: border-box (Mozilla (Firefox)), or quirks mode (Internet Explorer).
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #4
    New Coder
    Join Date
    Jun 2005
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, that is what I would need, that the border is part of the box. Problem is I am not very advanced and don't know how to do this.

    I though of another not very good option. I make 2 tables, one for the first row and one for the rest :-) The second width is 100%-2px :-)

    Jernej


  •  

    Posting Permissions

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