html - CSS中边框的调整

标签 html css

我希望 Div 的边框小于 div 的宽度。如何在 CSS 中实现它?

下图会让你更清晰:

http://imageshack.us/photo/my-images/440/divkr.jpg/

最佳答案

这对于纯 CSS 是不可能的。

不过,您可以使用两个 div 来获得这种效果。

<div class="outer">
<div class="inner">

    text

</div>
</div>​

.outer
{
    background-color:blue;
padding:20px;
    width:200px;
}

.inner
{
    border:solid 1px white;
    height:150px;
    color:white;
}

http://jsfiddle.net/RreTH/

http://jsfiddle.net/RreTH/1/

关于html - CSS中边框的调整,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9617754/

相关文章:

html - 显示 : inline always go to right align 中的文本对齐 css

javascript - HTML 标记中的区域蓝色轮廓?

css - div中图像的垂直对齐

html - 容器DIV高度不适应内容

javascript - jquery 函数根据第二个 jquery 函数选择的值创建表

jquery - toggle div 会填满 IE 中的剩余空间,但不会填满 google chrome 或 firefox

javascript - 更改timelineJS源码

html - 检测文本是否被jquery插入到输入字段然后运行一个函数

jquery - 单击更改文本区域高度

javascript - 具有漂亮悬停效果的 HTML5 和 CSS3 树形菜单