欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!

浮动元素的高度问题

1、在标准流中,内容的高度可以撑起父元素的高度。

2、在浮动流中,浮动的元素是不可以撑起父元素的高度的。

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>D129_FloatExcriseXia</title>

    <style>

        .fuyuansu,.fuyuansu1{

            border:2px black solid;

        }

        .biaozhun{

            width:100px;

            height: 100px;

            background-color: red;

        }

        .fudong{

            width:100px;

            height: 100px;

            background-color: yellow;

            float:left;

        }

</style>

</head>

<body>

<div>

    <div></div>

</div>

<hr>

<div>

    <div></div>

</div>

</body>

</html>

结果如图:

e83f8a5890ba4270c8719e1b8cf2ac4.png

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html/h57426.shtml