SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru Ize's Avatar
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    809
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Controlling table row margins

    Is there any way to control the margins between table rows?

    Look at this table for instance; http://www.whatstyle.net/bla/table-margin.html

    I know I can collapse everything by setting border-collapse to "collapse", but let's say I want some spacing between rows, to let the green table backgroundcolor show through, but I do not want the table cells to have any spacing between them.

    In order words, I want this table to look like this: http://www.whatstyle.net/bla/table-margin.jpg

    How would I achieve such a layout?

  2. #2
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You'd probably be better doing that by collapsing the border's and then applying border colours...

    Code:
    table {
    	width: 400px;
    	border: 2px green solid;
    	border-collapse: collapse;
    }
    tr {
    	background: skyblue;
    }
    th {
    	text-align: left;
    }
    td,th {
    	padding: 1em;
    }
    td {
    	border-top: 2px green solid;
    }

  3. #3
    SitePoint Guru Ize's Avatar
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    809
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Brilliant! Thanks a lot!


Bookmarks

Posting Permissions

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