有什么方法可以只在边框上添加边距吗?
只有边框应该有边距,而不是文本。
我正在尝试移动边框而不是文本字段。需要缩小/移动边框而不是文本。
CSS :
.margin-check {
border-bottom: 1px solid #d2d7da;
margin-left : 15px;
}
HTML :
<div class="margin-check">
Something I am typing for checking the border margin
</div>
JSFiddle:https://jsfiddle.net/c91xhz5e/ https://jsfiddle.net/c91xhz5e/
您可以使用伪元素,然后可以更改边框的大小
.margin-check {
display: inline-block;
position: relative;
}
.margin-check:after {
position: absolute;
content: '';
border-bottom: 1px solid #d2d7da;
width: 70%;
transform: translateX(-50%);
bottom: -15px;
left: 50%;
}
<div class="margin-check">
Something I am typing for checking the border margin
</div>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)