Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.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
Css 块元素没有响应_Css_Mobile - Fatal编程技术网

Css 块元素没有响应

Css 块元素没有响应,css,mobile,Css,Mobile,我有五个方形按钮在一行,我显示为锁。然而,当在手机上观看时,这5个图标并没有堆叠起来,它们聚集在一起,并与下面的元素重叠。我认为添加clear元素可以解决这个问题,但事实并非如此。谁能给我指出正确的方向吗 非常感谢,我非常感谢 .menu { height: 100px; clear: both; width:100%; margin-bottom:40px; margin-top:35px; } .icons { height: 100px;

我有五个方形按钮在一行,我显示为锁。然而,当在手机上观看时,这5个图标并没有堆叠起来,它们聚集在一起,并与下面的元素重叠。我认为添加clear元素可以解决这个问题,但事实并非如此。谁能给我指出正确的方向吗

非常感谢,我非常感谢

.menu {
    height: 100px;
    clear: both;
    width:100%;
    margin-bottom:40px;
    margin-top:35px;
}

.icons {
    height: 100px;
    width:100px;
    display: inline-block;
    margin-left:10px;
    margin-right:10px;
    margin-bottom:10px;
    background-color:#ffffff;
}
从.menu类中删除height属性,或者至少将其更改为min height,将允许父元素的高度扩展以适合其内容,从而将其后面的内容向下推到页面中

请参见下面的示例以获取说明

div{ 背景:绿色; 保证金:5px0; 填充物:5px; } p{ 字体系列:无衬线; 保证金:0; } p组{ 背景:红色; 最小高度:40px; } div~div{ 高度:20px; } 此段落的父段没有设置高度,因此将展开以适合此段落的高度

这只是一个占位符

此段落的父段具有设置的高度,因此不会展开以适合此段落的高度


这只是一个占位符

问题不清楚……您能给出html代码或JSFIDLE吗?作为一个明确的观点:两者都有;将强制.menu清除元素一侧的任何内容!你能提供一个例子,说明你在上面用小提琴或类似的工具来操作代码吗?清除只适用于已经浮动的项目…你的没有。很抱歉不清楚,这是菜单的小提琴。。。