首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Flex半引导

Flex半引导
EN

Stack Overflow用户
提问于 2021-10-09 03:01:55
回答 1查看 77关注 0票数 0

如何将图片从右侧移动到左侧?从左边到右边的表格是什么?我还不熟悉bootstrap,所以我不知道该怎么做。

Image

这是html代码。

代码语言:javascript
复制
  <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。

代码语言:javascript
复制
.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; }

请帮帮我,我真的很想把图像移到左边,把表格移到右边。但是我不知道即使我试着去做一些事情。

EN

回答 1

Stack Overflow用户

发布于 2021-10-09 04:44:34

删除img容器的order-md-2类,因为它会将img发送到右侧。

代码语言:javascript
复制
.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; }
代码语言:javascript
复制
 <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:全屏打开

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69503419

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档