• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 536
  • Last Modified:

Table border gap

Hi Experts,

I have attached an image of a simple html table and my goal is to have a red border beneath the <tr><th>.  So I set the css border property for <th> and as you can see there are space between the lines.  I'd like it to appear as one continuous line accross the top to table.

Here is the CSS for the <th>:

#rateTable th {
      
      padding:3px 3px 2px 3px;
      font-size:.9em;
      font-family:Arial, Helvetica, sans-serif;
      border-bottom:thin red solid;
}

How can I do this in CSS?

Thanks

HNM sample table image
0
HelpNearMe
Asked:
HelpNearMe
2 Solutions
 
Dave BaldwinFixer of ProblemsCommented:
Your table tag needs to says "cellspacing=0".  I don't believe that can be done in CSS.
0
 
TordanCommented:
the gap is being caused by the padding.
the common way to do this is to test an additional table so that underline is part of the 'outer' table and the text are part of 'inner' tables.
0
 
TordanCommented:
errrr
... is to NEST an additional table...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Dave BaldwinFixer of ProblemsCommented:
Demo of with and without:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>Untitled</title>
<style type="text/css">
<!-- 
td {background-color: #aaaaaa;} 
-->
</style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" summary="">
<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
</table>
&nbsp;
<table summary="">
<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
</table>
</body>
</html>

Open in new window

0
 
HainKurtSr. System AnalystCommented:
may help
<style>
table {
      border-spacing:0px;
      border:solid 1 gray;
      cell-spacing:0px;
}
.underlined {
      padding:3px 3px 2px 3px;
      font-size:.9em;
      font-family:Arial, Helvetica, sans-serif;
      border-bottom:solid 3px red;
      text-align:middle;
}
</style>

<table cellspacing=0>
<tr>
	<td class=underlined>Term</td>
	<td class=underlined>Our Rate</td>
	<td class=underlined>Bank Rate</td>
</tr>
<tr>
	<td>1 Year fixed</td>
	<td>3.95%</td>
	<td>5.89%</td>
</tr>
<tr>
	<td colspan=3>Updated August 13, 2010</td>
</tr>
</table>

Open in new window

0
 
HelpNearMeAuthor Commented:
I appreciate the replies, but DaveBaldwins did the trick.

Thanks!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now