English 中文(简体)
c 定位
原标题:css div positioning
  • 时间:2011-11-22 08:06:26
  •  标签:
  • css
  • html

What float and clear properties do I need to use in order to achieve the following layout? They are not part of a list, simply divs that should float next to each other as shown below.

“entergraph

最佳回答

In that order, declare :

div4 float right
div3 float right
div1
div2

但是,最后的布局将取决于四舍五入的大小,如果四舍五入的大小与贵方的公式不符,则可能会产生奇怪的结果。

问题回答
<div>
    <div style="float:left">
            <div style="background-color:Gray;width:100px;height:100px">
                div1
            </div>
            <div style="background-color:Yellow;width:100px;height:300px;">
            div4
        </div>
    </div>
    <div style="float:left;background-color:Green;width:100px;height:400px">
            div2
    </div>
    <div style="float:left;background-color:Maroon;width:100px;height:400px">
            div3
    </div>
</div>

根据你的要求,进行合理饮食和生育。

You need two wrapper divs and some simple floats:

传真:

<div id="left">
     <div id="div1">Div 1</div>
     <div id="div2">Div 2</div>
 </div> 
 <div id="right">
     <div id="div3">Div 3</div>
     <div id="div4">Div 4</div>
  </div> 

CSS:

div 
{
    width: 100px:;
    height: 100px;
    border: 1px dashed #000;
}

#left
{
    float:left;
    width: 200px;
    height: 200px;
}

#right,
#right div
{
    float: left;
    height: 200px;
}

#right div
{
    width: 200px;
}

改变信条:

<div id="dMain">
  <div id="d" class="flt">
     <div id="d1"></div>
     <div id="d2"></div>
  </div>
  <div id="d2" class="flt">

  </div>
  <div id="d3" class="flt">

  </div>
<br class="cls" />
</div>

风格:

.flt{ float:left; }
.cls{clear:both;}

这样做。 Float用于环绕浮物。 如同浮动:偷窃是指在案文左边浮动。 用于清除任何此类浮动。 更多人开始上学。

您可在四舍五入(第一期)内编出第1和第2号,并在另一批(第2号)中编出第3和第4号。 之后,你将第1号浮线抛开,还有第2号浮标。

同样:

  <div id="first" style="float:left">
     <div id="div1"></div>
     <div id="div2"></div>
 </div> 
 <div id="second">
     <div id="div3" style="float:left"></div>
     <div id="div4"></div>
  </div> 

You also need to write the width and height for every div.





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签