html - 使用两个div的双边框

标签 html css

我正在尝试制作一个内部白色边框和外部蓝色边框的深蓝色框。白色边框的 div 位于蓝色边框的 div 中。但我得到的只是一个深蓝色的大盒子。

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Practice 2014-4-22-01</title>
<style>
#bannerDiv {
    border: 2 px solid white;
    background-color: darkblue;
    color: white;
}
#outerDiv {
    border: 2 px solid blue;
}
</style>
</head>
<body>
<div id="outerDiv">
    <div id="bannerDiv">No double border :(</div>
</div>
</body>
</html>

输出:enter image description here

你可以在这里看到:JSFiddle .

最佳答案

不要在单位 (px) 前加空格。

关于html - 使用两个div的双边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23232064/

相关文章:

css - 为 html5(或任何文档类型)添加文档类型会破坏我的网站

html - 如何使用负 z-index 使链接可点击?

javascript - ui-router 中的多个 ui-view html 文件

javascript - Asp.net MVC Actionlink 动态添加路由值

html - CSS定位溢出

javascript - firefox 下载属性不起作用

html - CSS 问题 : Sentences do not start from the same starting point

html - 有没有一种方法可以仅使用 CSS 隐藏基于另一个 SELECT 的值的 SELECT?

html - 我正在寻找适用于两年或更早版本浏览器(如 IE9 及更高版本)的 CSS 重置文件

java - AppLayout 中如何将 Component ranged right 添加到 Navbar?