【发布时间】:2016-09-14 06:27:50
【问题描述】:
我想在我的 MVC 项目中用 css 绘制一个阴阳符号。所以我找到了一些 css,它可以满足我的需求:
#yin-yang {
width: 96px;
height: 48px;
background: #eee;
border-color: red;
border-style: solid;
border-width: 2px 2px 50px 2px;
border-radius: 100%;
position: relative;
}
#yin-yang:before {
content: "";
position: absolute;
top: 50%;
left: 0;
background: #eee;
border: 18px solid red;
border-radius: 100%;
width: 12px;
height: 12px;
}
#yin-yang:after {
content: "";
position: absolute;
top: 50%;
left: 50%;
background: red;
border: 18px solid #eee;
border-radius: 100%;
width: 12px;
height: 12px;
}
<div id="yin-yang"></div>
我可以很容易地让它在JSFiddle 中工作:
但我一插入in my MVC project,就画错了
这可能是什么原因?
【问题讨论】:
-
您的页面上是否有其他 CSS 可能会覆盖您的样式?
-
删除
box-sizing和webkit-box-sizing属性 -
注释掉 使它在 dotnetfiddle 中也能工作,所以正如@StephenMuecke 建议的那样,里面一定有东西。
-
Stephen Muecke:您能更深入地描述一下如何做到这一点吗?
-
查看forked DotNetFiddle(只需将
box-sizing: initial;添加到每个样式中以覆盖引导程序默认值)
标签: html css .net asp.net-mvc asp.net-mvc-4