CSS表默认填充或边距 [英] CSS table default padding or margin

查看:102
本文介绍了CSS表默认填充或边距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天这是我第一次玩桌子
,我注意到表和tr和td标签之间有一点空间,
喜欢1像素左右。 p>

这里是我的问题:



有我的代码:

 < table id =upload_box_container> 
< tr>
< td class =border_bottom_1px> hi1< / td>
< td class =border_bottom_1px> hi2< / td>
< / tr>
< / table>

(upload_box_container - 只是背景颜色和边框颜色)



(border_bottom_1px - 因为它的名称只能给出底部边框大小为1px)



并且有一个如何显示的图片:
< a href =http://postimage.org/image/16wz2ao78/ =nofollow noreferrer> http://postimage.org/image/16wz2ao78/



我的问题是




  • 为什么两个底边框之间有空格

    >
  • 以及为什么表格两侧有一个空格(例如填充),边框不接触表格边框




感谢。

解决方案

定义

  table {border-spacing:0; } 

,它应该以你想要的方式呈现。


Today it's my first time I'm playing around with tables and I have noticing that the table and tr and td tags have a little space between them, like 1 px or so.

So here is my problem :

There is my code :

<table id="upload_box_container">
    <tr>
        <td class="border_bottom_1px">hi1</td>
        <td class="border_bottom_1px">hi2</td>
    </tr>
</table>

(upload_box_container - it's just background color and border color)

(border_bottom_1px - as it's name it only gives bottom border with 1px size)

and there is a picture of how it displays: http://postimage.org/image/16wz2ao78/

My question is

  • why there is a space between the two bottom borders

  • and why there is a space in the sides of the table (like padding) and the borders don't touch the table border

thanks.

解决方案

Define

table { border-spacing:0; }

and it should render in the way you want.

这篇关于CSS表默认填充或边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆