填充在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>