CSS 边框不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5937148/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CSS Border Not Working
提问by Tara
I've been trying to get a border on either side of my white container. It's just not showing. I've tried to put it in three different elements just in case! (see below). Any ideas on how to make it work?
我一直试图在我的白色容器的两侧设置边框。就是不显示。我试着把它放在三个不同的元素中以防万一!(见下文)。关于如何使其工作的任何想法?
#wrapper {
width:1000px;
background:#F4F4F4;
padding-top:5px;
border: 3px #CDCDCD;
overflow: auto;
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto;
}
#casing {
padding:0px 0px 0px 0px;
background:#Fff;
border: 0 1px 0 1px solid #000;
}
#cover {
border: 0 1px 0 1px solid #000;
}
回答by ?ime Vidas
Do this:
做这个:
border: solid #000;
border-width: 0 1px;
Live demo:http://jsfiddle.net/aFzKy/
现场演示:http : //jsfiddle.net/aFzKy/
回答by Rudi Visser
I think you've just made up shorthand syntax for the border:
property there =)
我认为您刚刚为border:
那里的属性编写了速记语法=)
Try simply:
简单地尝试:
border-right: 1px solid #000;
border-left: 1px solid #000;
回答by Ken Ray
Have you tried using Firebug to inspect the rendered HTML, and to see exactly what css is being applied to the various elements? That should pick up css errors like the ones mentioned above, and you can see what styles are being inherited and from where - it is an invaluable too in any css debugging.
您是否尝试过使用 Firebug 检查呈现的 HTML,并准确查看将哪些 css 应用于各种元素?这应该会发现像上面提到的那些 css 错误,你可以看到哪些样式被继承以及从哪里继承 - 这在任何 css 调试中也是非常宝贵的。
回答by Anil Singhania
Use this line of code in your css
在你的 css 中使用这行代码
border: 1px solid #000 !important;
or if you want border only in left and right side of container then use:
或者,如果您只想要容器左侧和右侧的边框,请使用:
border-right: 1px solid #000 !important;
border-left: 1px solid #000 !important;
回答by Tatu Ulmanen
AFAIK, there's no such shorthand for border. You have to define each border separately:
AFAIK,边界没有这样的简写。您必须分别定义每个边框:
border: 0 solid #000;
border-left: 1px solid #000;
border-right: 1px solid #000;
回答by Dan
The height is a 100% unsure, try putting display: block; or display: inline-block;
高度是 100% 不确定,尝试放置 display: block; or display: inline-block;