如何浮动div项填空间div父? [英] how to float div items fill in space div parent?

查看:83
本文介绍了如何浮动div项填空间div父?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的HTML



my html

<div class="parent">
    <div class="child">1</div>
    <div class="child">2</div>
    <div class="child">3</div>
    <div class="child-wide">4</div>
    <div class="child">5</div>
    <div class="child">6</div>
    <div class="child">7</div>
</div>





我的css





my css

.parent { 
width:408px; 
display:inline-block; 
background-color:orange;
color:white;
}
.parent div {
float:left;
height:100px;
background-color:green;
border:1px solid white;
font-size:36px;
text-align:center;
}
.child { width:100px;}
.child-wide { width:202px;}



如何将子填充空间div父级?对不起,我的英语非常糟糕。


how to float child fill in space div parent? sorry, my english very bad.

推荐答案

如果你想要并排的元素,你也可以看看使用
If you're wanting the elements side-by-side you could also look at using
display: inline-block 

,因为这将使它们对齐一条线而不是一条线。

on the child class as this will align them in a line rather than beneath one another.


这篇关于如何浮动div项填空间div父?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆