填充在div边框 [英] Padding on div border

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

问题描述

我想把填充放在CSS边框。将其拉入div内,远离边缘。这是可能使用css(css3很好,webkit)。

I want to put padding on a css border. Pull it inside a div, away from the edge. Is this possible using css (css3 is fine, webkit).

这是设计。

我通过在div div,然后给内部div一个边框。我想使标记slim作为可行的,所以我想只使用一个div如果可行。

I did this by placing a div inside a div, then give a border to the inner div. I want to make the markup slim as posible so I want to use only one div if posible.

谢谢。

推荐答案

您应该能够使用CSS大纲属性:

You should be able to do this with the CSS outline property:

<style>
.outer {
       outline: 2px solid #CCC;
       border: 1px solid #999;
       background-color: #999;
       }
</style>

<div class="outer">
example
</div>

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

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