本文介绍了在div容器内放置两个div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能并排放置两个div?



左边div必须对齐顶部,左边
第二个顶部,右边。
两者必须在容器内并且尊重自动增长......

谢谢。





  .devCtrl,#leftcolumn,#rightcolumn {
background: rgba(255,255,255,.3);
border-color:rgba(255,255,255,.6);
border-style:solid;
border-width:1px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
}

#leftcolumn {
display:inline;
min-height:400px;
float:left;
width:440px;
}

#rightcolumn {
width:440px;
min-height:400px;
float:right;


解决方案

/

  #containerDiv {
overflow:hidden;
margin-top:7px;
margin-left:7px;
margin-right:7px;
}

/ Div的共享规则 /

  .container,#leftDiv,#rightDiv {
background:rgba(255,255,255,.3);
border-color:rgba(255,255,255,.6);
border-style:solid;
border-width:1px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
width:414px;

$ / code>

/ *所有表格* /

  .container td {
padding-right:10px;
text-align:justify;
}

/ leftDiv特定信息 /

  #leftDiv {
float:left;
padding:10px;
}

/ rightDiv特定信息 /

  #rightDiv {
float:right;
padding:10px;
}


How can I put two divs side by side?

The left div has to be aligned top, leftThe second top, right.Both has to be "inside" the container and respect auto-growth...

Thanks.

this is what I've done:

.devCtrl,#leftcolumn,#rightcolumn {
    background: rgba(255, 255, 255, .3);
    border-color: rgba(255, 255, 255, .6);
    border-style: solid;
    border-width: 1px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
}

#leftcolumn {
    display:inline;
    min-height: 400px;
    float: left;
    width: 440px;
}

#rightcolumn {
    width: 440px;
    min-height: 400px;
    float: right;
}
解决方案

/Div container/

#containerDiv {
    overflow: hidden;
    margin-top: 7px;
    margin-left: 7px;
    margin-right: 7px;
}

/Div's shared rules/

.container,#leftDiv,#rightDiv {
    background: rgba(255, 255, 255, .3);
    border-color: rgba(255, 255, 255, .6);
    border-style: solid;
    border-width: 1px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    width: 414px;
}

/*All tables */

.container td {
   padding-right: 10px;
   text-align: justify;
}

/leftDiv specific info/

#leftDiv {
    float: left;
    padding: 10px;
}

/rightDiv specific info/

#rightDiv {
    float: right;
    padding: 10px;
}

这篇关于在div容器内放置两个div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-10 18:49