Is it possible to extend a cell's border width/height so that it joins with the border of surrounding table?
I have this:
<table width="270px" style="border: 1px;">
<tbody width="270px">
<tr>
<th colspan="3" style="border: 1px;">
Header
</th>
</tr>
<tr>
<td style="border: 1px;" valign="middle">
Left-hand cell
</td>
<td valign="middle">
Right-hand cell
</td>
<td>
Left-hand cell
</td>
</tr>
</tbody>
</table>
What is happening is the inner borders don't meet the outer border - there is a slight gap.
Can I get these border to meet?
Have a look at CSS border-collapse.
table
{
border-collapse: collapse;
}
Also, have a look at this answer on how to achieve cellpadding and cellspacing in CSS.
From Ant P.'s answer:
... just for completeness:
padding → cellpadding
border-spacing → cellspacing
border-collapse → no HTML equivalent
It's also worth remembering that you can set separate horizontal and vertical values for the CSS ones e.g. border-spacing: 0 1px.
Try this and let me know:
<table width="270px" style="border: 1px;" cellspacing="0" cellpadding="0">
<tbody width="270px">
<tr>
<th colspan="3" style="border: 1px;">
Header
</th>
</tr>
<tr>
<td style="border: 1px;" valign="middle">
Left-hand cell
</td>
<td valign="middle">
Right-hand cell
</td>
<td>
Left-hand cell
</td>
</tr>
</tbody>
</table>
Related
i want to remove space between table, heres my code
<table class="table table-striped-column" border="2" style="border-color: #0082AD">
<tr>
<th>Icon</th>
<th style="width:65%; text-align:left">Football Forums</th>
<th>Topics</th>
<th>Posts</th>
<th style="width:35%">Last Post</th>
</tr>
<!--INSERT DATA-->
<tr>
<td>Icon</td>
<td>
<table border="2">
<tr>
<td>link</td>
<td>view</td>
<td>image</td>
</tr>
<tr>
<td colspan="2" style="font-size:10px">ket</td>
</tr>
<tr>
<td colspan="2" style="font-size:10px">sponsored</td>
</tr>
</table>
i hve tried using margin 0 and padding 0, i also tried using cellpadding n cellspacing but its not working at all
and i want to remove this
You have a margin set on the table. Clear it on the nested tables using:
td table {
margin: 0;
}
Also, the border, cellspacing and cellpadding attributes are deprecated (since a long time). You should use CSS for that.
I've tried everything I can find so far in other stack overflow questions to solve this issue but can't get it figured out. I've got an HTML table with background images that I'm using to create rounded dividers/bubbles around specific items on a website. I can't get the table rows to completely go away though. And it seems like they are only to top and right that are showing a division? Both CSS and the table are shown below. Here's an image of what I can't get rid of. You can see the thin line right under the curves down then along the right side of the right border. It shows up other places too but the background is so close to the border color that it's not noticeable.
Also there is some redundant CSS in there I've just been trying everything I can find/think of in order to fix is.
I can't add images but here's a link with the image of the result I keep getting http://www.bdtransport.com/devel/TableIssue.JPG
Code:
table {
border-collapse: collapse;
border-spacing: 0;
border: none !important;
padding: 0 0 0 0;
margin: 0 auto;
}
tr, td {
padding: 0 0 0 0;
spacing: 0
border: none !important;
outline: none;
border-collapse: collapse;
}
<TABLE width='1100' align='center'>
<TR>
<TD colspan='5' background='./images/MainTop.jpg'> </TD>
</TR>
<TR>
<TD background='./images/MainLeft.jpg' width='75'> </TD>
<TD background='./images/MainNewsBackground.jpg' width='687'> Text </TD>
<TD background='./images/MainNewsDivider.jpg' width='22'> </TD>
<TD background='./images/MainNotificationsBackground.jpg' width='250'> Recent/Upcoming Info: </TD>
<TD background='./images/MainRight.jpg' width='66'> </TD>
</TR>
</table>
Please note that the following code snippet has been edited to include border="0" in the table opening. This should remove all borders.
<TABLE width='1100' align='center' border="0">
<TR>
<TD colspan='5' background='./images/MainTop.jpg'> </TD>
</TR>
<TR>
<TD background='./images/MainLeft.jpg' width='75'> </TD>
<TD background='./images/MainNewsBackground.jpg' width='687'> Text </TD>
<TD background='./images/MainNewsDivider.jpg' width='22'> </TD>
<TD background='./images/MainNotificationsBackground.jpg' width='250'> Recent/Upcoming Info: </TD>
<TD background='./images/MainRight.jpg' width='66'> </TD>
</TR>
</table>
If that did not remove all borders, you can try:
<TABLE width='1100' align='center' style="border:0">
<TR>
<TD colspan='5' background='./images/MainTop.jpg'> </TD>
</TR>
<TR>
<TD background='./images/MainLeft.jpg' width='75'> </TD>
<TD background='./images/MainNewsBackground.jpg' width='687'> Text </TD>
<TD background='./images/MainNewsDivider.jpg' width='22'> </TD>
<TD background='./images/MainNotificationsBackground.jpg' width='250'> Recent/Upcoming Info: </TD>
<TD background='./images/MainRight.jpg' width='66'> </TD>
</TR>
</table>
That should remove the border. With this method, there is also no need for overly complicated CSS code in your page.
I want to write the simpliest example of the following image
My example should work in ie6,7,8,9 and so on. So I can't use float or anything helpfull. I made jsFiddle using table
<table width="500px">
<tr>
<td width="45px"><span>e-mail</span>
</td>
<td align="center"> <div style="border-bottom: 1px solid;">test#gmail.com</div></td>
</tr>
<tr>
<td width="45px"></td>
<td align="center"> <span>(email)</span>
</td>
</tr>
</table>
, but the bottom (email) have margin from the line.
And I want that everything was like on my first image. Thanks
I have tried this.
Check this jsFiddle link
<table width="500px" style="padding:0px; border-spacing:1px">
<tr>
<td width="45px" style="padding:0px"><span>e-mail</span>
</td>
<td align="center" style="padding:0px"> test#gmail.com <hr noshade style="border-top:1px; -webkit-margin-before: 0; -webkit-margin-after: 0; -webkit-margin-top: 0; -webkit-margin-bottom: 0;"/> </td>
</tr>
<tr>
<td width="45px" style="padding:0px"></td>
<td align = "center" style = "margin-top:0px; padding:0px">(email)</td>
</tr>
The “margin” you are referring to is partly spacing between cells, partly padding inside the cell, partly leading, and partly spacing in the font. In your approach, the simplest fix is probably to set cell spacing to zero and to move the cell content upwards a bit, using relative positioning.
<table width="500" cellspacing="0">
<tr>
<td width="45">e-mail
</td>
<td align="center" style="border-bottom: 1px solid">test#gmail.com</td>
</tr>
<tr>
<td width="45"></td>
<td align="center"><span style="position: relative; top: -0.15em">(email)</span>
</td>
</tr>
</table>
apply border-spacing: 0 to the table's style (border-collapse: collapsewould work too, aswell as cellspacing attribute)
add padding: 0 to the tdcontaining <span>(email)</span>
To increase the space between the upper e-mail-adress and the bottom border (which you did not mention explicitly but is not the same as your example image):
move the border-bottom style from div to its parent td
add a padding-bottom to the same td
I have a HTML newsletter table, to structure the content I want horizontal borders. Somehow the horizontal borders always have 100% width according to the table width. How can I achieve 20px padding to the left and right of it?
js fiddle
HTML
<table border="1" cellpadding="0" cellspacing="0" align="center" width="400">
<tr>
<td >Banana
</td>
</tr>
<tr style=" padding: 0 20px 0 20px;">
<td style=" padding: 0 20px 0 20px; border-bottom: 3px solid red;">
</td>
</tr>
<tr>
<td >Apple
</td>
</tr>
</table>
you can't able to do what you want in current code
you need to do some trick
see this
<table border="0" cellpadding="0" cellspacing="0" align="center" width="400">
<tr>
<td >Banana
</td>
</tr>
<tr >
<td> <hr style=" border:0px; margin: 0 20px 0 20px; border-bottom: 3px solid red;">
</td>
</tr>
<tr>
<td >Apple
</td>
</tr>
</table>
i have used (HR) tag in 2nd table row, this will solve your problem ☺
A border does not take padding into account, but it does with margin. See the CSS Box Modell for reference.
On CSS, there is the cascade. It parses top-dowmn and specific overrides general
There are many ways to achieve what you want (including ways in which we have to change the HTML code). Suppose you want to keep the table layout. You can just set the border-left and border-right of the middle td like this:
tr.hr > td {
border:none;
border-left:20px solid white;
border-right:20px solid white;
background:red;
height:3px;
}
HTML:
<tr> <td> Banana </td> </tr>
<tr class='hr'> <td></td></tr>
<tr> <td> Apple </td> </tr>
Demo.
Note that the color of border-left and border-right should be the same to the background color of your table. (they are all white in the demo).
Please have a look at the HTML email boilerplate.
http://htmlemailboilerplate.com/#f1
Limitations using CSS: http://www.campaignmonitor.com/css/. It solves may issues with ie. spacing amongst others and email clients rendering issues (Gmail, Outlook,Yahoo, ...)
HTML emails need to respect 600px width as it is a default for the preview.
To test the HTML email (if no mail configured on a testing server) you could use http://putsmail.com/ Check also on smart phone as many people tend to read mail on it
You can achieve the effect using a combination of 3 cells where the first and last use spacers and the middle can be a red solid color gif.
<table cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td valign="top" width="20"><img width="20" height="3" src="transparent.gif" alt="" /></td>
<td valign="top" width="560">
<img src="red.gif" width="560" height="3" alt="" />
</td>
<td valign="top" width="20"><img width="20" height="3" src="transparent.gif" alt="" /></td>
</tr>
</table>
I'm trying to align two table's borders. Please take a look on this small example
http://jsfiddle.net/kf82J/2/
On Internet Explorer and Chrome, the right border is not aligned, but works on Firefox.
My goal is to be able to draw a line that "aligns" width the middle of the title, it's difficult to explain with words, just check the jsfiddle.
Same code below
<table style="width:100%;border-collapse: collapse;">
<tr style="height: 10px;">
<td style="width: 1px;">
</td>
<td rowspan="2" style="font-size:19pwhite-space:nowrap;x;width:1px;">
Title
</td>
<td style="height:50%;">
</td>
</tr>
<tr style="height: 10px;">
<td>
</td>
<td style="height:50%;border-top: 1px solid black; border-right: 1px solid black;">
</td>
</tr>
</table>
<table style="width:100%;border-collapse: collapse;border:1px solid black;border-top:none;">
<tr>
<td>Content</td>
</tr>
</table>
Remove below line from css for table
border-collapse: collapse;
It worked for me in fiddle.
Alternately you could try adding a transparent border for the first table
<table style="border:1px solid transparent;>