设置第2个浮动div 将Box-2的float属性也设置为left,可以看到Box-2也变为根据内容确定宽度,并使Box-3的文字围绕Box-2排列。 改变浮动的方向 将Box-3改为向右浮动,可以看到Box-3移动到了最右端,文字段落盒子的范围没有改变,但是文字变成了夹在Box-2和Box-3之间。 <! 当慢慢缩小浏览器窗口时,Box-2和Box-3的距离会越来越小,文字会布满空间,但缩小到一定程度时,Box-3会被挤到下一行,但仍保持向右浮动。 ? 再次改变浮动的方向 将Box-2改为向右浮动,Box-3改为向左浮动。布局和上面例子一样。 View Code ? 当慢慢缩小浏览器窗口时,Box-2和Box-3的距离会越来越小,文字会布满空间,但缩小到一定程度时,Box-3会被挤到下一行,但仍保持向左浮动。 ?
border-radius: 20px } .box-2{ order:2; flex-grow:2; background:#666; border-radius: 20px } .box <body>
jpg">
height: 100px; background: red; } #box-2 { width: 100px; height: 100px; background: blue; } #box inline-block; } body { background: #efefef; }
<div id="<em>box</em>100px; background: red; } #box-2 { width: 100px; height: 100px; background: blue; } #box ; } body { background: #efefef; } html部分
<div id="<em>box</em>0,0,0,0.5); text-indent: 100px; cursor: pointer; } .box-2 ul .on { background: rgba(255,255,255,0.6); } .box font-size: 60px; margin-top: -40px; border-radius: 5px; text-align: center; cursor: pointer; } .box -3 .prev { left: 10px; } .box-3 .next { right: 10px; } .box-3 span::selection { background: transparent ; } .box-3 span:hover { background: rgba(255,255,255,.5); color: rgba(255,255,255,1) } #div1 {
container">
基于此,举几个例子:
<div class="="selfadaption-layout">
<div class="<em>box</em> background-color: #f66; } .box-2 { height: 15%; background-color: #3c9; } .<em>box</em>