将div放在表格单元格内 [英] Placing a div inside a table cell
本文介绍了将div放在表格单元格内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图获得一个DIV元素到表格单元格,在DIV沿着所有单元格的区域传播。但是,由于未知的原因,一个1px的边框出现;据我所知,它既不是表的一部分或div(表没有边框,填充或间距,div没有边距或填充)。也许你能找到我的错误?
I'm trying to get a DIV element into a table cell, in a way in which the DIV spreads along all the cell's area. But, for unknown reason, a 1px border appears; as far as I know, it's neither part of the table or the div (table has no borders, padding or spacing, and the div has no margin or padding). Perhaps you can spot me the bug?
<html>
<head>
<style type="text/css">
#arrow {
border-style: solid;
margin: 0;
padding: 0;
border-width: 100px 0px 100px 50px;
border-color: blue blue blue red;
}
table {
border-collapse: collapse;
border-style: none;
padding: 0px;
spacing: 0px;
}
</style>
</head>
<body>
<table>
<tr>
<td bgcolor="red">
Blah,
</td>
<td>
<div id="arrow"><!----></div>
</td>
<td bgcolor="blue">
blah.
</td>
</tr>
</table>
推荐答案
<table cellspacing="0" cellpadding="0" border="0">
- 或 -
td { padding:0 }
这篇关于将div放在表格单元格内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文