1 回答
TA贡献1829条经验 获得超9个赞
我找到了您问题的答案,它与您的原始代码具有相同的风格。我添加了一些演示号码进行测试。
div#hand {
position: fixed;
bottom: -200px;
left: 0;
width: 100vw;
height: auto;
display: flex;
justify-content: center;
overflow-x: auto;
overflow-y: auto;
}
div.wrapper {
background-color: #333;
overflow: auto;
white-space: nowrap;
}
div.card {
display: inline-block;
color: white;
text-align: center;
padding: 14px;
text-decoration: none;
}
div#hand > div.wrapper div.card {
cursor: pointer;
position: relative;
width: 230px;
height: 350px;
margin: 0;
border-radius: 3px;
border-style: dotted;
border-width: 5px;
border-color: #fff;
background-color: black;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
margin-top: 60px;
bottom: 0;
display: inline-flex;
align-items: center;
justify-content: center;
transition: 0.4s;
}
div#hand > div.wrapper div.card:not(:first-child) {
margin-left: -160px;
}
div#hand > div.wrapper div.card:hover:not(:last-child) {
margin-right: 160px;
}
div#hand > div.wrapper div.card:hover {
bottom: 60px;
}
Code
<div id="hand">
<div class="wrapper">
<div class="card">
<h2>1</h2>
</div>
<div class="card">
<h2>2</h2>
</div>
<div class="card">
<h2>3</h2>
</div>
<div class="card">
<h2>4</h2>
</div>
<div class="card">
<h2>5</h2>
</div>
<div class="card">
<h2>6</h2>
</div>
<div class="card">
<h2>7</h2>
</div>
<div class="card">
<h2>8</h2>
</div>
<div class="card">
<h2>9</h2>
</div>
<div class="card">
<h2>10</h2>
</div>
<div class="card">
<h2>11</h2>
</div>
<div class="card">
<h2>12</h2>
</div>
<div class="card">
<h2>13</h2>
</div>
<div class="card">
<h2>14</h2>
</div>
<div class="card">
<h2>15</h2>
</div>
<div class="card">
<h2>16</h2>
</div>
<div class="card">
<h2>17</h2>
</div>
<div class="card">
<h2>18</h2>
</div>
<div class="card">
<h2>19</h2>
</div>
<div class="card">
<h2>20</h2>
</div>
</div>
</div>
</div>
- 1 回答
- 0 关注
- 111 浏览
添加回答
举报