Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.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 右CSS属性和左CSS属性在输入组引导4中无法正常工作_Html_Css_Web_Bootstrap 4_Css Position - Fatal编程技术网

Html 右CSS属性和左CSS属性在输入组引导4中无法正常工作

Html 右CSS属性和左CSS属性在输入组引导4中无法正常工作,html,css,web,bootstrap-4,css-position,Html,Css,Web,Bootstrap 4,Css Position,我有一个搜索输入。我在引导程序4中使用了输入组。现在,我想用left和right属性将此元素定位为绝对定位。奇怪的是,这些属性中只有一个有效,但不是两个都有效。有什么想法为什么会发生这种情况以及解决方案吗 下面是一个JSFIDLE: 提前感谢。 .search-group { position: absolute !important; left: 50px !important; bottom: 5px; width: calc(100% - 100px) }

我有一个搜索输入。我在引导程序4中使用了
输入组
。现在,我想用
left
right
属性将此元素定位为绝对定位。奇怪的是,这些属性中只有一个有效,但不是两个都有效。有什么想法为什么会发生这种情况以及解决方案吗

下面是一个JSFIDLE:

提前感谢。

.search-group {
    position: absolute !important;
    left: 50px !important;
    bottom: 5px;
    width: calc(100% - 100px)
}

在css中添加
width:calc(100%-100px)
<代码>右侧:50px
也在工作。但是,在您的
.input组中,
类具有
宽度:100%
。因此,它无法按预期工作。

感谢您提供此解决方案。它将使用width属性,但为什么不使用
right
?@MagedSaeed
right
也可以使用。由于
类中的
宽度:100%
,它无法工作