【发布时间】:2020-12-01 17:04:29
【问题描述】:
我在下面附上一个片段,如您所见,两个按钮显示不同的高度,我希望它们在我更改页面大小时具有相同的高度,并且在同一行。
我不想只说高度:100px,因为当我在手机上打开它时它会变形。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<style>
.dropbtn {
background-color: #264653;
border: none;
color: white;
padding: 0.1%;
text-align: center;
cursor: pointer;
width: 100%;
flex-grow: 1;
display: block;
}
.dropdown {
position: relative;
display: block;
width: 100%;
}
</style>
</head>
<body>
<h1 align="center" style="padding-left: 20px; width: 100%">ANNOTATION TOOL</h1>
<div style="width: 100%; height: 100%;" class="container-fluid">
<div class="dropdown" style="width: 50%; float:left; height: 100%;">
<button class="dropbtn" style="width: 100%; height:100%;"><h2>File: 2019717_1828_FMCI_107.txt Device 107 </h2> </button>
</div>
<div class="dropdown" style="width: 50%; float:right; height: 100%;">
<button class="dropbtn" style="height: 100%;"><h2> Channel:0 <i class="fa fa-caret-down"></i></h2> </button></div>
</body>
非常感谢您的帮助。
【问题讨论】:
-
你可以使用
white-space: nowrapnowrap 到你的按钮高度 -
@Adhitya TY 为您回复!我应该把“空白:nowrap”放在哪里?我认为它不起作用..
-
进入你的
.dropbtncss,你可以试试 -
是的,没错,你只需要在两个按钮中调整响应,后面我再举个例子。
-
@Stracci 下面的答案是正确的??
标签: html css twitter-bootstrap-3