如何将图片从右侧移动到左侧?从左边到右边的表格是什么?我还不熟悉bootstrap,所以我不知道该怎么做。
这是html代码。
<div class="d-lg-flex half">
<div class="bg order-1 order-md-2" style="background-image: url('images/register.svg');"></div>
<div class="contents order-2 order-md-1">
<div class="container">
<div class="row align-items-center justify-content-center">
<div class="col-md-7">
<div class="form-group first">
<label for="username">Email</label>
<input type="email" class="form-control" required>
</div>
<input type="submit" value="Login" class="btn btn-primary">
</div>
</div>
</div>
</div>
</div>这是css。
.half, .half .container > .row {
height: 100vh;
min-height: 700px; }
@media (max-width: 991.98px) {
.half .bg {
height: 200px; } }
.half .contents {
background: #f6f7fc; }
.half .contents, .half .bg {
width: 50%; }
@media (max-width: 1199.98px) {
.half .contents, .half .bg {
width: 100%; } }
.half .contents .form-control, .half .bg .form-control {
border: none;
-webkit-box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
border-radius: 4px;
height: 54px;
background: #fff; }
.half .contents .form-control:active, .half .contents .form-control:focus, .half .bg .form-control:active, .half .bg .form-control:focus {
outline: none;
-webkit-box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1); }
.half .bg {
background-size: cover;
background-position: center; }
.half a {
color: #888;
text-decoration: underline; }
.half .btn {
height: 54px;
padding-left: 30px;
padding-right: 30px; }
.half .forgot-pass {
position: relative;
top: 2px;
font-size: 14px; }请帮帮我,我真的很想把图像移到左边,把表格移到右边。但是我不知道即使我试着去做一些事情。
发布于 2021-10-09 04:44:34
删除img容器的order-md-2类,因为它会将img发送到右侧。
.half, .half .container > .row {
height: 100vh;
min-height: 700px; }
@media (max-width: 991.98px) {
.half .bg {
height: 200px; } }
.half .contents {
background: #f6f7fc; }
.half .contents, .half .bg {
width: 50%; }
@media (max-width: 1199.98px) {
.half .contents, .half .bg {
width: 100%; } }
.half .contents .form-control, .half .bg .form-control {
border: none;
-webkit-box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
border-radius: 4px;
height: 54px;
background: #fff; }
.half .contents .form-control:active, .half .contents .form-control:focus, .half .bg .form-control:active, .half .bg .form-control:focus {
outline: none;
-webkit-box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1); }
.half .bg {
background-size: cover;
background-position: center; }
.half a {
color: #888;
text-decoration: underline; }
.half .btn {
height: 54px;
padding-left: 30px;
padding-right: 30px; }
.half .forgot-pass {
position: relative;
top: 2px;
font-size: 14px; } <link rel= stylesheet href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css">
<div class="d-lg-flex half">
<div class="bg order-1" style="background-image: url('https://picsum.photos/200/300');"></div>
<div class="contents order-2 order-md-1">
<div class="container">
<div class="row align-items-center justify-content-center">
<div class="col-md-7">
<div class="form-group first">
<label for="username">Email</label>
<input type="email" class="form-control" required>
</div>
<input type="submit" value="Login" class="btn btn-primary">
</div>
</div>
</div>
</div>
</div>
codepen here
PS:全屏打开
https://stackoverflow.com/questions/69503419
复制相似问题