Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.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“a”(simplediv) 和div'b,它是float:left 我想知道将div'a'的高度设置为div'b'的完美包装的正确的方法是什么(根据高度) 我知道有一些选择: 1) 设置“a”:溢出:隐藏(有效) 2) 在“b”div末尾设置为“clear”:两个 )我想知道更多的选择(除了固定高度到a区…) )当然,还有更好的办法 @Royi-Namir;还有其他像这样的疯子吗 css: .clearfix:after { display: block; c

我有一个div“a”(simplediv)

和div'b,它是
float:left

我想知道将div'a'的高度设置为div'b'的完美包装的正确的方法是什么(根据高度

我知道有一些选择:

1) 设置“a”:溢出:隐藏(有效)

2) 在“b”div末尾设置为“clear”:两个

  • )我想知道更多的选择(除了固定高度到a区…)

  • )当然,还有更好的办法


    • @Royi-Namir;还有其他像这样的疯子吗

      css:

      .clearfix:after {
          display: block;
          content: " ";
          clear: both;
          }
      
      按照更好的方法
      clearfix
      overflow:hidden
      两者都更好,因为您不需要为每个元素在html中编写任何
      额外标记