【发布时间】:2019-08-22 09:10:50
【问题描述】:
我对所有内容都使用相对单位(百分比):字体、表格的宽度和高度等。但包含计算器按钮和显示的表格仍然与任何设备的屏幕尺寸不匹配。
我已经尝试将每个按钮的“高度”属性设置为一定的百分比,以及计算器的显示,这样我就可以使计算器框适合整个设备屏幕。
.botonesOP{
border-style:groove;
border-width:2px;
border-radius:10%;
text-align:center;
font-size:100%;
width:22.5%;
height:25%;
box-shadow: 7px 7px 30px rgb(113, 247, 135);
background: radial-gradient(rgb(12, 133, 42), rgb(13, 68, 5),
rgb(6, 44, 2));
color: white;
}
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<script type="text/javascript" src="operaciones.js"></script>
<link href="estiloscalc.css" rel="stylesheet"/>
</head>
<body>
<section>
<div>
<input type="text" id="display" readonly>
</div>
<input type="button" class="botonesN" onclick="siete()" value="7">
<button type="button" class="botonesN" onclick="ocho()">8</button>
<button type="button" class="botonesN" onclick="nueve()">9</button>
<button type="button" class="botonesOP" onclick="mas()">+</button>
<button type="button" class="botonesN" onclick="cuatro()">4</button>
<button type="button" class="botonesN" onclick="cinco()">5</button>
<button type="button" class="botonesN" onclick="seis()">6</button>
<button type="button" class="botonesOP" onclick="menos()">-</button>
<td><button type="button" class="botonesN" onclick="uno()">1</button>
<td><button type="button" class="botonesN" onclick="dos()">2</button>
<td><button type="button" class="botonesN" onclick="tres()">3</button>
<td><button type="button" class="botonesOP" onclick="multip()">x</button>
<button type="button" class="botonesN" onclick="punto()">.</button>
<button type="button" class="botonesN" onclick="cero()">0</button>
<button type="button" class="botonesN" onclick="igual()">=</button>
<button type="button" class="botonesOP" onclick="divis()">/</button>
<button type="button" class="botonesOP" onclick="ce()">C</button>
<button type="button" id="botonEspecial" onclick="cuo()">CÚO</button>
</section>
</body>
</html>
【问题讨论】:
-
欢迎来到 SO @Alberto。请您分享您认为的 HTML,以便我们提供帮助。
-
非常感谢迈克!好的,我将立即分享 HTML。只有我把整个东西放在桌子外面检查它是否可以工作,但没有成功。
标签: javascript java android html css