他,我爲我的應用程序的標準模板工作。我非常喜歡CSS,而且我正在努力做出一個很好的響應式設計。如何使我的CSS響應
現在,這是我的想法:
這是它是如何工作:
現在有了一些Java腳本,我可能可以做到這一點,但如果這是可能在CSS中會很好。我的問題是我怎樣才能使我的設計只有HTML和CSS。
一個的jsfiddle剛剛脫穎而出的樂趣:
我的CSS:
body{
font-family:"Trebuchet MS",sans-serif;
padding:0px;
margin:0px;
}
#content{
min-height: 100%;
width: 100%;
position: absolute;
background-color: #5adc23;
}
input[type="button"]{
border:2px outset rgb(166, 166, 166);
display:inline-block;
}
input[type="button"]:hover{
border:2px inset rgb(166, 166, 166);
display:inline-block;
cursor: pointer;
}
#mainbar{
height: 31px;
background-color: rgb(109, 164, 227);
background-image: -webkit-linear-gradient(0deg, rgb(39, 162, 207) 1%, rgb(63, 181, 224) 36%, rgb(63, 181, 224) 64%, rgb(39, 162, 207) 100%);
}
#mainbar_border{
height: 100%;
border-bottom:1px solid rgb(0, 0, 0);
color: rgb(255, 255, 255);
font-family: 'Courier New', serif;
font-size: 21px;
}
#mainmenu{
width: 40px;
height: 96%;
min-height: 100%;
margin-top: 0px;
margin-bottom: 0px;
float: left;
}
#mainmenu_border{
height: 99%;
padding: 4px;
padding-top: 46px;
padding-bottom: 19px;
border-bottom-width: 1px;
border-left-width: 1px;
border-bottom-style: solid;
border-left-style: solid;
}
#mainmenu_item_container{
list-style-type:none;
}
#content_app{
float: left;
width: 88%;
height: 96%;
}
#content_app_border{
height: 99%;
padding: 4px;
border-bottom-width: 1px;
border-left-width: 1px;
border-bottom-style: solid;
border-left-style: solid;
border-right-width: 1px;
border-right-style: solid;
}
我的html:
<div id='content' class='invoer'>
<div id='mainbar'>
<div id='mainbar_border'>
Mainbar
</div>
</div>
<div id='mainmenu'>
<div id='mainmenu_border'>
<ul id='mainmenu_item_container'>
<li><input type='button' value='Load content' title='load some more shit to test the resposive design' id='btn' action='loadmoreshit' /></li>
<li>button</li>
<li>button</li>
</ul>
</div>
</div>
<div id='content_app'>
<div id='content_app_border'>
content
<br>
<br>
<br>
</div>
</div>
</div>
問題是,當有更多的內容#content和#left_nav必須展開。看到http://jsfiddle.net/hfNCp/1/ – botenvouwer 2013-04-22 15:10:25
好了一些編輯後,我做你的例子動態擴展高度。但是現在我必須將總高度的最小高度 - 頭部的40px。那麼Javascript就是了! – botenvouwer 2013-04-22 15:16:39
試試這個 - http://jsfiddle.net/x6hsF/1/;我認爲它可能更接近你要找的東西。這會在內容周圍使用一個容器,並使用'overflow:auto;'左側導航欄,並將左側導航欄和內容設置爲'min-height:100%;',這樣它們將始終展開到屏幕底部,但如果內容擴展超出該容器,容器將生成一個滾動條。 – 2013-04-22 15:21:43