SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard donboe's Avatar
    Join Date
    Jun 2010
    Location
    Netherlands
    Posts
    2,108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thin table borders

    It's seems like ages ago that I used tables for the last time and my memory on how to solve certain things, seems to be solved. I need a small calendar which obviously need borders around each <td>. This is what I have sofar:
    Code CSS:
    .calendar table { 
    	border: 1px solid #000;
    	text-align: center;
    	padding: 0;
    	margin: 0;
     
    }
     
    .calendar th, .calendar td { 
    	border: 1px solid #000;
    	font-size: 12px;
    	padding: 2;
    	margin: 0;
    }
    But since the cells touch each other the 1px becomes 2px. I thought to remember that setting a background-color for the <th> and <td> would solve that problem, but that thought was wrong. Any suggestion would be more than welcome.

    Thank you in advance;
    “Good artists copy, great artists steal” (Pablo Picasso - 1934)

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)

  3. #3
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,278
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)

  4. #4
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    Stomme Poes has it correct -- border-collapse:collapse is the best answer as it will do exactly what you want.

    ANOTHER technique is to put border-width:0 0 1px 1px on the table, and border-width:1px 1px 0 0 on your TD/TH... then you only have ONE border.


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
  •