我想讓我的表,以保持身體的50%的大小,而不是到了頁面大小的範圍內,但是當我調整到手機大小像350像素或更小,它會超出範圍。如何解決這個問題?謝謝HTML RWD調整表格
View post on imgur.com CSS代碼
<style type="text/css">
body{
padding-top: 10px;
padding-left: 10px;
width: 100%;
}
.scrolltable {
overflow-x: visible;
height: 100%;
display: flex;
display: -webkit-flex;
flex-direction: column;
-webkit-flex-direction: column;
}
.scrolltable > .header {
}
.scrolltable > .body {
/*noinspection CssInvalidPropertyValue*/
width: -webkit-fit-content;
overflow-y: scroll;
flex: 1;
-webkit-flex: 1;
box-shadow: 10px 10px 5px #888888;
}
/* an outside constraint to react against */
#constrainer {
float: right;
margin-right: 80px;
width: 50%;
height:250px;
}
table {
font-size:22px;
border-collapse: collapse;
}
th, td {
border-radius:25px;
min-width:120px;
}
th {
color: white;
border-width: 1px;
font-weight: bold;
background-color:#3986d3;
padding-top: 5px;
padding-bottom: 5px;
}
td {
border-width: 1px;
text-align:center;
padding-top: 5px;
padding-bottom: 5px;
}
tr:first-child td {
border-top-width: 0;
}
tr:nth-child(even) {
background-color:#f2f2f2 ;
}
tr:hover{background-color:#BEBEBE}
</style>
HTML下面
<body>
<div id="constrainer">
<div class="scrolltable">
<table class="header">
<thead>
<th>
工位
</th>
<th>
位置
</th>
<th>
速度
</th>
<th>
加速度
</th>
<th>
減速度
</th>
<th>
加加速度
</th>
</thead>
</table>
<div class="body">
<table>
<tbody>
<tr>
<td>原點</td>
<td id="inp01"></td>
<td id="inp02"></td>
<td id="inp03"></td>
<td id="inp04"></td>
<td id="inp05"></td>
</tr>
<tr>
<td>01</td>
<td id="inp11"></td>
<td id="inp12"></td>
<td id="inp13"></td>
<td id="inp14"></td>
<td id="inp15"></td>
</tr>
<tr>
<td>02</td>
<td id="inp21"></td>
<td id="inp22"></td>
<td id="inp23"></td>
<td id="inp24"></td>
<td id="inp25"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<button id="btnright1" style="width:50px; height:50px;" />
<div style="margin-left:100px;">
<p>速度</p> <input id="setSpeed" type="number" style="width:100px; height:30px; border-radius: 20px; " />
</div>
</body>
你可以點你可以編輯哪個部分 – seasonqwe
我發現我唯一需要的是最小寬度寬 – seasonqwe
你知道爲什麼第{寬度:120像素;}寬度,當我在屏幕上放大仍然會改變嗎? – seasonqwe