今天在写代码的时候发现表格具有一些默认的样式有时候并不需要,它会影响美观!可以通过以下方式去掉它。
cellpadding – 代表单元格外面距离,用于隔单元格与单元格空间 。
cellspacing-- 代表表格边框与单元格补白距离,单元格补白间距离。
方法1:(在css样式中设置)
table{
border-collapse:collapse; //表格的边框合并,如果相邻,则共用一个边框。
border-spacing:0px; //设置行与单元格边框的间距。
}
方法2:(在行内设置)
<table border="0" cellspacing="0" cellpadding="0">
1
下面是我的代码,大家可以更加加深了解!!!,
<style type="text/css">
table{
border-collapse:collapse;
border-spacing:0px;
}
img{
width:40px;
height:40px;
}
</style>
<body>
<