<!doctype html>
<html>
<head>
<style>
body{
background: #eee
}
#variableNames {
float:left;
margin:10px;
padding:10px;
}
#variables{
float:left;
margin:10px;
padding:10px;
}
</style>
</head>
<body>
<h1>Amortized Loan Calculator</h1>
<div id = "variableNames">
<h5 id = "Apr">Annualized Percentage Rate:<input type = "text"/></h5>
<h5 id = "Ttm">Time To Maturity In Months:<input type = "text"/></h5>
<h5 id = "Cost">Asset Price:<input type = "text"/></h5>
<h5 id = "DownPayment">Down Payment:<input type = "text"/></h5>
</div>
<script src = "mortgage.js"></script>
</body>
</html>JS文件与此无关。目前,文本输入直接位于每个h5元素的右侧,描述它们中的内容。由于头的长度不同,所以输入不对齐。我希望输入沿着x轴彼此直接对齐,就像它们在自己的div元素中一样,但是我也希望它们中的每一个都直接与y轴上对应的头对齐,这就是为什么我不能从它们的h5父母中取出它们并将它们粘贴到div中。我怎么能解决这个问题?
发布于 2016-01-27 03:12:33
你可以加上:
input{
float:right;
}我认为这给了你你想要的东西。还可以通过将选择器更改为:
h5 input{
float:right;
}https://stackoverflow.com/questions/35028034
复制相似问题