【发布时间】:2021-03-26 19:11:42
【问题描述】:
我正在使用卡片在网站上显示信息。我希望卡片彼此并排。 我听说这样做的方法是将每张卡片放在一个列中。
当我这样做时,我想要的 2 张卡片的所有间距都消失了。第一张牌在屏幕左侧没有间距,第二张牌在第一张牌的右边。 我的 container-fluid div 中的其他元素通常有一点边距,但列没有。
代码:
<div class="row">
<div class="card mb-3" style="width: 22rem;">
<ul class="list-group list-group-flush">
<li class="list-group-item">Name: User</li>
<li class="list-group-item">Email: User@email.com</li>
<li class="list-group-item">
<label for="exampleInputPassword1" class="form-label">Password: </label>
<input id="exampleInputPassword1" type="password" disabled value="{{session['password']}}" style="width: 10rem">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-eye-fill"
viewBox="0 0 16 16" style="margin-top:-5px; margin-left: 5px" id="iconUnselected"
onmousedown="document.getElementById('iconUnselected').classList.add('d-none');
document.getElementById('iconSelected').classList.remove('d-none')
document.getElementById('exampleInputPassword1').setAttribute('type', 'text')">
<path d="M10.5 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z"/>
<path fill-rule="evenodd" d="M0 8s3-5.5 8-5.5S16 8 16 8s-3 5.5-8 5.5S0 8 0 8zm8 3.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z"/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-eye d-none"
viewBox="0 0 16 16" id="iconSelected" style="margin-top:-5px; margin-left: 5px"
onmouseup="document.getElementById('iconSelected').classList.add('d-none');
document.getElementById('iconUnselected').classList.remove('d-none')
document.getElementById('exampleInputPassword1').setAttribute('type', 'password')">
<path fill-rule="evenodd" d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.134 13.134 0 0 0 1.66 2.043C4.12 11.332 5.88 12.5 8 12.5c2.12 0 3.879-1.168 5.168-2.457A13.134 13.134 0 0 0 14.828 8a13.133 13.133 0 0 0-1.66-2.043C11.879 4.668 10.119 3.5 8 3.5c-2.12 0-3.879 1.168-5.168 2.457A13.133 13.133 0 0 0 1.172 8z"/>
<path fill-rule="evenodd" d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/>
</svg>
</li>
<li class="list-group-item">Status: Standard</li>
<li class="list-group-item">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#editInfo">Edit Info</button>
<button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#deleteAccount">Delete Account</button>
</li>
</ul>
</div>
<div class="card mb-3 col-100" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title">About</h5>
<p class="card-text">Sample About Text</p>
</div>
</div>
</div>
有谁知道如何解决这个问题或更好地找到一种更有效的方法让两张卡彼此相邻?谢谢
在这张图片中看到,边距不一样(红色箭头所示)。下面,我有一张卡片遵守容器流体给出的适当边距,但 div 中的上述卡片没有也没有边距。我需要准确地说。不要给卡片添加边距,因为放大时仍然存在一些差异。
【问题讨论】:
标签: html css twitter-bootstrap