填充从外表边界线 [英] padding from outside table border line

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

问题描述

快速问题。我有一张桌子,它有一个边框。当我添加填充时,它会从表格中添加内部



尊重
(无论我显示的是什么)



解决方案

我不是100%肯定你的意思,但你可能想要这个。



HTML:



 < table> 
< tr>
< td>储存格1< / td>
< td>单元2< / td>
< / tr>
< / table>



CSS:



  body {
padding:20px;
}
table {
width:400px;
height:400px;
outline:2px solid red;
outline-offset:-15px;
}
td {
border:2px solid blue;
}

仅表:
$ b

此处的演示

仅限单元格



DEMO HERE



c $ c> outline ,你可以在它上面加上 outline-offset 。因此,如果使用 - 值,这将使它进入表。使用它作为边框,但记住它不计入宽度或高度。



注意:您可以在每个单元格等上使用。


quick question. I have a table, it has a border. When I add padding, it adds the padding from the inside of the table. Any way to make it add padding from outside the border?

Essentially, the table border lines should appear to be within its cell.

Regards (Whatever I am displayed as)

解决方案

Im not 100% sure what you mean but you may want this.

HTML:

<table>
    <tr>
        <td>Cell 1</td>
        <td>Cell 2</td>
    </tr>
</table>

CSS:

body {
    padding: 20px;
}
table {
    width: 400px;
    height: 400px;
    outline:2px solid red;
    outline-offset: -15px;
}
td {
    border:2px solid blue;
}

Table only:

DEMO HERE

Cell only:

DEMO HERE

So here we are setting an outline and you can put an outline-offseton it. So this will bring it into the table if you use - value. Use it as a border but remember it doesn't count towards width or height.

Note: You can use this on each cell etc.

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

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