[英]How to set width of a <hr/> in CSS to X number of pixels less than the width:auto?
I have a nav with some <hr/>
elements. 我有一些带有
<hr/>
元素的导航。 Preferably in pure CSS (3?), how would set the width of the horizontal rules to auto minus X number of pixels? 优选地,在纯CSS(3?)中,如何将水平规则的宽度设置为自动减去X个像素数?
This does not duplicate this question , because it is for what would equate to negative padding, which is impossible. 这并不重复这个问题 ,因为它等于负填充,这是不可能的。
You could use the below. 你可以使用下面的内容。
hr {
width: auto;
margin: 0 10px; /* This leaves 10px margin on left and right. If only right margin is needed try margin-right: 10px; */
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.