嘿,我想获取 div 的宽度并将其作为边框宽度添加到 css 类。提前致谢!
这是div:
<div id="web" class="well">
<div style="padding:19px">
<a style="text-decoration:none;" class="boxclose web_close"></a>
<h2 style="color:#242424; font-weight:bold;"><em style="color:#4fd886;">—</em> Web.</h2>
<p></p>
</div>
</div>
这是 CSS 类:
.well:before {
width: 0;
height: 0;
content: "";
border-bottom: 81px solid #fff;
border-left:/*WIDTH HERE*/ solid transparent;
position: absolute;
bottom: 100%;
}
最佳答案
我没有提到您想要任何一侧的边框,例如左边框、右边框等或所有方向的边框。 我已尝试解决您的查询,请在下面找到 fiddle 链接..
.well{
position:relative;
float:left;
}
.well:before {
width: 100%;
height: 100%;
content: "";
position: absolute;
top: 0;
left:0;
border:1px solid red;
}
关于javascript - 获取 div 宽度并添加到边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29701125/