HTML
<div id="page"><div id="results"><div class="result">1+2</div>
<div class="result">3*4</div><div class="result">5/9</div>
<div class="result">y=mx+b</div></div><input id="eq" type="text" autofocus=""></div>
CSS
@import url(http://fonts.googleapis.com/css?family=Rokkitt);
body {
background-color: #444047;
margin: 0;
padding: 0;
}
#page {
width: 40%;
background-color: #ececec;
position: fixed;
top: 0;
bottom: 0;
left: 50%;
margin-left: -20%;
}
#results {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 75px;
}
#eq {
width: 96%;
margin-left: -48%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
-ms-border-radius: 20px;
-o-border-radius: 20px;
border-radius: 20px;
border-width: 2px;
border-color: #9A9A9A #EEEEEE #EEEEEE #9A9A9A;
border-style: solid;
font-family: 'Rokkitt', serif;
letter-spacing: 1px;
font-size: 24pt;
padding: 5px 10px;
position: absolute;
bottom: 10px;
left: 50%;
}
#eq:focus {
border-color: #4E9FF2 #84B2E0 #84B2E0 #4E9FF2;
-webkit-box-shadow: 0 0 10px #007eff;
-moz-box-shadow: 0 0 10px #007eff;
-ms-box-shadow: 0 0 10px #007eff;
-o-box-shadow: 0 0 10px #007eff;
box-shadow: 0 0 10px #007eff;
outline: none;
}
#results {
font-family: 'Rokkitt', serif;
font-size: 16pt;
vertical-align: bottom;
text-align: left;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
padding: 5px;
display: table-cell;
overflow: auto;
}
.result {
padding: 2px;
}
.result + .result {
border-top: 1px dotted gray;
}
如何将 div 对齐到容器.result
的底部?#result
编辑:#results
如果 s 太多.result
无法容纳,则 div 需要获得滚动条。overflow:auto
似乎与以下某些解决方案不兼容。