Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何设置a的宽度<;hr/>;在CSS到X的像素数小于宽度:自动?_Html_Css - Fatal编程技术网

Html 如何设置a的宽度<;hr/>;在CSS到X的像素数小于宽度:自动?

Html 如何设置a的宽度<;hr/>;在CSS到X的像素数小于宽度:自动?,html,css,Html,Css,我有一个带有一些元素的导航。最好是在纯CSS(3?)中,如何将水平规则的宽度设置为自动减去X个像素数 这不会重复,因为它是用于等同于负填充的内容,这是不可能的。尝试使用右边距 或者,您可以使用Javascript实现更具体的功能。例如: CSS: hr { margin-right:20px; width:auto; } 您可以使用以下选项 hr { width: auto; margin: 0 10px; /* This leaves 10px margi

我有一个带有一些

元素的导航。最好是在纯CSS(3?)中,如何将水平规则的宽度设置为自动减去X个像素数


这不会重复,因为它是用于等同于负填充的内容,这是不可能的。

尝试使用
右边距

或者,您可以使用Javascript实现更具体的功能。例如:

CSS:

hr {
   margin-right:20px;
   width:auto;    
}

您可以使用以下选项

hr {
    width: auto;
    margin: 0 10px; /* This leaves 10px margin on left and right. If only right margin is needed try margin-right: 10px; */
}

您是否考虑过使用CSS3 calc函数?文档位于:。浏览器支持:“如果只需要权限,请尝试右边距:0px;”这句话听起来很奇怪。“right”的一个出现应该是“left”。