2015-04-03 120 views
0

我使用的引导,我想对齐父内三个格没有任何边界:如何对齐的div里面父DIV并填写

<div id="parent" class="col-lg-12"> 
     <div id="main"> ... </div> 
     <div id="leftside"> ... </div> 
     <div id="bottom"> ... </div> 
    </div> 

DIV #bottom网页:填写底部父DIV从左至右高度:100像素

DIV #leftside:填补顶部左侧的div#底部与100px的

DIV #main:填写父div的其余部分

更新: 我的问题是不够准确。 我想这样的事情: jsfiddle.net/kvs72e2j 但没有固定的财产。我希望div可以填满父母,父母必须填写它是超级的,但不是窗口。

回答

0

HTML:

<div id="parent" class="col-lg-12"> 
<div id="top"> 
    <div id="leftside"> ... </div> 
    <div id="main"> ... </div> 
</div> 
    <div id="bottom"> ... </div> 

CSS:

#parent { 
    position: relative; 
    background-color: black; 
} 

#top { 
    padding-bottom: 100px; 
} 

#leftside { 
    background-color: red; 
    float: left; 
    width: 100px; 
} 

#main { 
    background-color: blue; 
} 

#bottom { 
    background-color: green; 
    position: absolute; 
    bottom: 0; 
    height: 100px; 
    width: 100%; 
} 

我刚刚意识到,我把它过于复杂。这里有一个简单的解决方案: HTML:

<div id="parent" class="col-lg-12"> 
    <div id="leftside"> ... </div> 
     <div id="main"> ... </div> 
     <div id="bottom"> ... </div> 
    </div> 

CSS:

#parent { 
    background-color: black; 
} 

#leftside { 
    float: left; 
    min-width: 100px; 
    background-color: red; 
} 

#main { 
    background-color: blue; 
} 

#bottom { 
    clear: both; 
    background-color: green; 
    height: 100px; 
} 
+0

非常感谢您!不幸的是我仍然没有解决我的问题。我想得到这样的东西:http://jsfiddle.net/kvs72e2j但在这个解决方案divs是固定的。我需要他们来填补父母。父母必须填写它的父母.. – 2015-04-03 19:22:50

+0

看看这个小提琴的工作原理:https://jsfiddle.net/undoingtech/1rchcorr/1/ – UndoingTech 2015-04-03 20:02:52

+0

谢谢!完善! :) – 2015-04-04 06:14:15