Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.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 在同一水平行中使DIV标记的宽度相等?_Html_Css - Fatal编程技术网

Html 在同一水平行中使DIV标记的宽度相等?

Html 在同一水平行中使DIV标记的宽度相等?,html,css,Html,Css,我想使div标签“添加更多项目”和“删除项目”的相等宽度在同一行上 getting both tag on same row but there size are not equal... 添加更多项目 删除项目 试试这个: <div data-role="controlgroup" data-type="horizontal" class="ui-controlgroup ui-controlgroup-horizontal ui-corner-all" style="margin

我想使div标签“添加更多项目”和“删除项目”的相等宽度在同一行上

getting both tag on same row but there size are not equal...

添加更多项目
删除项目
试试这个:

 <div data-role="controlgroup" data-type="horizontal" class="ui-controlgroup ui-controlgroup-horizontal ui-corner-all" style="margin: 20px; width: auto">

            <div class="ui-btn ui-first-child"   style="   position: relative;  center; background-color: #36CD5A; color: #fff; text-shadow: none !important;"  data-inline="true" onclick="javascript:addNewItem()">Add More Item</div>

            <div class="ui-btn ui-last-child"  style="  position: relative; text-align: center; background-color: #36CD5A; color: #fff; text-shadow: none !important;"  onclick="javascript:removeAddedItem()">Remove Item</div>
        </div>

添加更多项目|
删除项目

添加
宽度:50%
浮动:左侧
,下面是代码


添加更多项目
删除项目

您可以通过表或css伪属性进行设置。下面是完整的扩展示例。查看一下

所有示例都是示例,请勿复制和粘贴。

示例内联块,响应,第n个子(范围)

.wrapper{
宽度:90%;
外形:1px绿色固体;
保证金:0自动;
}
.wrapper>div{
宽度:49%;
显示:内联块;
轮廓:纯黄色;
}
.wrapper>div:n子级(-n+2){
背景颜色:绿色;
}
.wrapper>div:n子级(n+3):n子级(-n+4){
背景色:红色;
}
.wrapper>div:n子级(n+5):n子级(-n+6){
背景颜色:粉红色;
}

我喜欢红色
我喜欢粉红色
我喜欢绿色
我喜欢爬虫
我喜欢绿色
我喜欢紫色

你能在JSFIDLE中添加你的代码吗?有很多方法,它需要响应吗?它是固定宽度的吗?等更多细节,我们很乐意帮助您。@PhilAndelhofs,这里的float将使div坐在其他div旁边。你也可以使用display:inline blockKumar,我不再关注这个了。。避免浮动是一个很好的提示。。你了解内联、内联块和块级元素之间的区别吗???@PhilAndelhofs是的,我知道内联、内联块和块级元素之间的区别,这就是为什么我提到了Therkumar,对不起。。困惑,给我一点时间Kumar是的,你提到过,只是避免布局使用浮点,文本包装TEC使用浮点
<div data-role="controlgroup" data-type="horizontal" class="ui-controlgroup ui-controlgroup-horizontal ui-corner-all" style="margin: 20px; width: auto;background-color:#36CD5A;">

    <div class="ui-btn ui-first-child" style="   position: relative;  center; color: #fff; text-shadow: none !important;display: inline;" data-inline="true" onclick="">Add More Item</div> |

    <div class="ui-btn ui-last-child" style="  position: relative; text-align: center;color: #fff; text-shadow: none !important;display: inline;" onclick="">Remove Item</div>
</div>