設置寬度或高度自動響應能力像你想要的。
<head>
<meta charset="utf-8" />
<title>Bootstrap, from Twitter</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" />
<meta name="author" content="" />
<!-- Le styles -->
<link data-require="bootstrap-css" data-semver="4.0.0-alpha.4" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/css/bootstrap.min.css" />
<link data-require="[email protected]*" data-semver="4.0.5" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" />
<style>
.label-list {
margin: 5px 5px 5px 0;
border-radius: 0;
font-size: 12px;
background-color: #ececec;
border-color: #e8e8e8;
color: #444;
width:auto;
height:45px;
text-align:center;
}
</style>
<script data-require="jquery" data-semver="3.1.1" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.js"></script>
<script data-require="bootstrap" data-semver="4.0.5" src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/js/bootstrap.min.js"></script>
</head>
<body>
<label class="btn btn-primary label-list">test label</label>
<label class="btn btn-primary label-list">test label test test test</label>
</body>
</html>
等待我將修改它,閱讀它錯誤地 – FreedomPride
按鈕寬度不應該甚至大含量的變化,而不是我想要的字體大小應適當減少 –
你不能只用CSS做到這一點。你需要JavaScript。 –