没有显示HTML Div边框 [英] HTML Div border not showing
本文介绍了没有显示HTML Div边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在HTML中为div元素添加边框。以下是我的代码。
#container-border {border-width:2px; border-color:red;}
< div id = 容器边界> ...< / div>
边框不显示。我看了一个类似的问题(这里),但我无法弄清楚为什么边框不显示。有什么建议吗?
注意:这段代码是HTML页面的一部分。其他代码可根据要求提供 border-style
是 none
。您需要为边框设置不同的值。
#container -border {border-width:2px;边框颜色:红色; border-style:dashed;}
< div id = 容器边界> ...< / div>
I'm trying to add a border to a div element in HTML. Below is my code.
#container-border {
border-width: 2px;
border-color: red;
}
<div id="container-border">
...
</div>
For some reason, the border doesn't show up. I had a look on a similar question (here) but I couldn't figure out why the border doesn't show up. Any suggestions please?
Note: This snippet is a part of an HTML page. Additional code could be provided upon request
解决方案
The default value of border-style
is none
. You need to set a different value for a border to appear.
#container-border {
border-width: 2px;
border-color: red;
border-style: dashed;
}
<div id="container-border">
...
</div>
这篇关于没有显示HTML Div边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文