Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.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 如何固定按钮,使其不会因邻近元件的影响而改变其位置?_Html_Css_Twitter Bootstrap - Fatal编程技术网

Html 如何固定按钮,使其不会因邻近元件的影响而改变其位置?

Html 如何固定按钮,使其不会因邻近元件的影响而改变其位置?,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,我有这个密码 <button class='btn btn-danger btn-xs minus'> <span class='glyphicon glyphicon-minus'></span> </button> &nbsp; <span class='quantity bold font20' val='1'>1</span> &nbsp; <button class='btn bt

我有这个密码

<button class='btn btn-danger btn-xs minus'>
    <span class='glyphicon glyphicon-minus'></span>
</button>

&nbsp;
<span class='quantity bold font20' val='1'>1</span>
&nbsp;

<button class='btn btn-success btn-xs plus'>
    <span class='glyphicon glyphicon-plus'></span>
</button>
这是你的电话号码

您需要
浮动:左
每个
按钮
数量
然后给出
数量
宽度。如果数字增加并溢出,将显示滚动条

按钮,
.数量{
浮动:左
}
.bold{
字体大小:粗体;
}
font20先生{
字体大小:20px;
}
.数量{
/*使文本水平居中*/
文本对齐:居中;
边框:1px实心#ccc;
/*需要将跨度显示为块*/
显示:块;
宽度:70px;
/*如果溢出显示滚动条,或者您可以更改为溢出-x:隐藏而不显示滚动条*/
溢出-x:自动;
字体大小:粗体;
利润率:0.10px;
}
.clearFloat{
明确:两者皆有;
}

-
99999
+

尝试以下操作:在span标记中添加宽度和高度

.quantity{
显示:内联块;
宽度:50px;
文本对齐:居中;
高度:30px;
背景#f1f1;
垂直对齐:中间对齐;
}
.bold{
字体大小:粗体;
}
font20先生{
字体大小:20px;
}

1.

请共享您的css代码..将宽度添加到QuantityWedth。。没用!因为它是一个跨距,所以在应用Width之前,您需要将其设为内联块(很高兴能帮助您:)
.bold
{
    font-weight: bold;
}

.font20
{
    font-size: 20px;
}