Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
62 lines (55 sloc) 1.42 KB
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>item 宽度已知 或 未知,元素按照行数在响应容器</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.wrapper {
width: 430px;
padding: 10px;
margin: 150px auto;
border: 2px solid rgb(240, 103, 103);
}
.container {
margin-bottom: 20px;
}
.container:last-child {
margin-bottom: 0;
}
.item {
display: inline-block;
margin-right: 30px;
padding: 5px 10px;
font-size: 20px;
border-radius: 5px / 5px;
background: rgb(103, 164, 243);
}
.item:last-child {
margin-right: 0;
}
</style>
</head>
<body>
<div class="wrapper">
<div class='container'>
<div class='item'>两个才能成一行呀...</div>
<div class='item'>两个才能成一行呀...</div>
</div>
<div class='container'>
<div class='item'>三个成一行</div>
<div class='item'>三个成一行</div>
<div class='item'>三个成一行</div>
</div>
<div class='container'>
<div class='item'>独成一行呀独成一行呀独成一行呀独</div>
</div>
<div class='container'>
<div class='item'>四个呀</div>
<div class='item'>四个呀</div>
<div class='item'>四个呀</div>
</div>
</div>
</body>
</html>