css 移动的View Div未占用剩余空间

cuxqih21  于 2023-04-08  发布在  其他
关注(0)|答案(1)|浏览(129)

我的页面看起来totaly找到在大视图(从桌面),但对于小视图(手机)这个div标签是不占用剩余空间我想要的是标题应该写在单行标题是h4在一个div标签(在手机视图)如果你想检查我的网站在检查模式这是我的网站链接:https://linux-coder.netlify.app/enter image description here im using bootstrap 5.0.2,因为这是我的旧项目,我想完成它.两个标题的HTML:

<div id="features" style="background-color: #E7E7E7;" class="container-middle-center-fluid">

    <section style="padding: 0;">

      <div class="container-middle-center py-3" style="margin-left: 0; margin-right: 0;">
        <h2 class="pb-2 border-bottom text-center" style="margin-top: 48px;">Specialities</h2>

        <div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 row-cols-lg-4 g-4 py-5 justify-content-center">  

<div class="col d-flex align-items-center column-custom">
            <img class="d-none d-lg-block" width="120px" height="auto" style="margin-right: 50px; margin-right: 50px;"
              src="/img/mobile_friendly.png" alt="">

            <div>
              <h4 class="fw-bold mb-0 mobile-text"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
                  fill="currentColor" class="bi bi-phone d-lg-none mobile-icon" viewBox="0 0 16 16">
                  <path
                    d="M11 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h6zM5 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H5z" />
                  <path d="M8 14a1 1 0 1 0 0-2 1 1 0 0 0 0 2z" />
                </svg>MOBILE-FRIENDLY</h4>
              <p class="d-none d-md-block">A responsive design makes your website accessible to all users, regardless of
                their device.</p>
            </div>


          </div>
          <div class="col d-flex align-items-center column-custom">
            <img class="d-none d-lg-block" width="120px" height="auto" style="margin-right: 50px; margin-right: 50px;"
              src="/img/content management.png" alt="">

            <div>
              <h4 class="fw-bold mb-0 mobile-text"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
                  fill="currentColor" class="bi bi-kanban-fill mobile-icon" viewBox="0 0 16 16">
                  <path
                    d="M2.5 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2h-11zm5 2h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm-5 1a1 1 0 0 1 1-1h1a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1V3zm9-1h1a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z" />
                </svg>CONTENT MANAGEMENT</h4>
              <p class="d-none d-md-block">Custom WordPress theme and plugin development. Easily update content without
                knowing how to code.</p>
            </div>
          </div>


    
              

        </div>
      </div>

    </section>
  </div>

CSS:

@media (max-width:768px) {
    .mobile-text {
        font-weight: 600 !important;
        font-size: medium;
        /* color: red; */
        font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    }

    .mobile-icon {
        margin-right: 10px;
        color: #018673;

    }

    .footer-mobile-text {
        display: flex !important;
        justify-content: center;
    }

    .mobile-footer-padding {
        /* padding: 0; */
        /* margin: 0; */
    }
}

脚本和CSS包括:

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
    integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.4/font/bootstrap-icons.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js"
    integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF"
    crossorigin="anonymous"></script>

我想在div标签的标题是在移动的视图中的单行,它不占用空间,他们的两侧。

rkttyhzu

rkttyhzu1#

问题是,您需要为所有六个div添加width:50%;,即电子商务,分析,移动友好,内容管理,设计开发,网站审核......

<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 row-cols-lg-4 g-4 py-5 justify-content-center" style="
">
          <div class="col d-flex align-items-center column-custom" style="
    width: 50%;
">
            <!-- <svg class="bi text-muted flex-shrink-0 me-3" width="1.75em" height="1.75em">
              <use href="/img/cart.png">
            </svg> -->
            <img class="d-none d-lg-block" width="120px" height="auto" style="margin-right: 50px; margin-right: 50px;" src="/img/cart.png" alt="">

            <div>
              <h4 class="fw-bold mb-0 mobile-text"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-cart2 d-lg-none mobile-icon" viewBox="0 0 16 16">
                  <path d="M0 2.5A.5.5 0 0 1 .5 2H2a.5.5 0 0 1 .485.379L2.89 4H14.5a.5.5 0 0 1 .485.621l-1.5 6A.5.5 0 0 1 13 11H4a.5.5 0 0 1-.485-.379L1.61 3H.5a.5.5 0 0 1-.5-.5zM3.14 5l1.25 5h8.22l1.25-5H3.14zM5 13a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0zm9-1a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0z"></path>
                </svg>ECOMMERCE</h4>
              <p class="d-none d-md-block">Integration of eCommerce platforms, payment gateways, custom product
                templates, and more.</p>
            </div>
          </div>
          <div class="col d-flex align-items-center column-custom" style="
    width: 50%;
">
            <img class="d-none d-lg-block" width="120px" height="auto" style="margin-right: 50px; margin-right: 50px;" src="/img/analytics.png" alt="">
            <div>
              <h4 class="fw-bold mb-0 mobile-text"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard2-data-fill mobile-icon" viewBox="0 0 16 16">
                  <path d="M10 .5a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5.5.5 0 0 1-.5.5.5.5 0 0 0-.5.5V2a.5.5 0 0 0 .5.5h5A.5.5 0 0 0 11 2v-.5a.5.5 0 0 0-.5-.5.5.5 0 0 1-.5-.5Z"></path>
                  <path d="M4.085 1H3.5A1.5 1.5 0 0 0 2 2.5v12A1.5 1.5 0 0 0 3.5 16h9a1.5 1.5 0 0 0 1.5-1.5v-12A1.5 1.5 0 0 0 12.5 1h-.585c.055.156.085.325.085.5V2a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 4 2v-.5c0-.175.03-.344.085-.5ZM10 7a1 1 0 1 1 2 0v5a1 1 0 1 1-2 0V7Zm-6 4a1 1 0 1 1 2 0v1a1 1 0 1 1-2 0v-1Zm4-3a1 1 0 0 1 1 1v3a1 1 0 1 1-2 0V9a1 1 0 0 1 1-1Z"></path>
                </svg>ANALYTICS</h4>
              <p class="d-none d-md-block">Get insights into who is browsing your site so that you can make smarter
                business decisions.</p>
            </div>

          </div>
          <div class="col d-flex align-items-center column-custom" style="
    width: 50%;
">
            <img class="d-none d-lg-block" width="120px" height="auto" style="margin-right: 50px; margin-right: 50px;" src="/img/mobile_friendly.png" alt="">

            <div>
              <h4 class="fw-bold mb-0 mobile-text"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-phone d-lg-none mobile-icon" viewBox="0 0 16 16">
                  <path d="M11 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h6zM5 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H5z"></path>
                  <path d="M8 14a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"></path>
                </svg>MOBILE-FRIENDLY</h4>
              <p class="d-none d-md-block">A responsive design makes your website accessible to all users, regardless of
                their device.</p>
            </div>


          </div>
          <div class="col d-flex align-items-center column-custom" style="
    width: 50%;
">
            <img class="d-none d-lg-block" width="120px" height="auto" style="margin-right: 50px; margin-right: 50px;" src="/img/content management.png" alt="">

            <div>
              <h4 class="fw-bold mb-0 mobile-text"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-kanban-fill mobile-icon" viewBox="0 0 16 16">
                  <path d="M2.5 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2h-11zm5 2h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm-5 1a1 1 0 0 1 1-1h1a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1V3zm9-1h1a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z"></path>
                </svg>CONTENT MANAGEMENT</h4>
              <p class="d-none d-md-block">Custom WordPress theme and plugin development. Easily update content without
                knowing how to code.</p>
            </div>
          </div>
          <div class="col d-flex align-items-center column-custom" style="
    width: 50%;
">
            <img class="d-none d-lg-block" width="120px" height="auto" style="margin-right: 50px; margin-right: 50px;" src="/img/design_developemt.png" alt="">

            <div>
              <h4 class="fw-bold mb-0 mobile-text"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-file-earmark-code-fill mobile-icon viewBox=" 0="" 16="" 16"="">
                  <path d="M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707A1 1 0 0 0 13.707 4L10 .293A1 1 0 0 0 9.293 0zM9.5 3.5v-2l3 3h-2a1 1 0 0 1-1-1zM6.646 7.646a.5.5 0 1 1 .708.708L5.707 10l1.647 1.646a.5.5 0 0 1-.708.708l-2-2a.5.5 0 0 1 0-.708l2-2zm2.708 0 2 2a.5.5 0 0 1 0 .708l-2 2a.5.5 0 0 1-.708-.708L10.293 10 8.646 8.354a.5.5 0 1 1 .708-.708z"></path>
                </svg>DESIGN + DEVELOPMENT</h4>
              <p class="d-none d-md-block">Clean, modern designs - optimized for performance, search engines, and
                converting users to customers.
              </p>
            </div>
          </div>

          <div class="col d-flex align-items-center column-custom" style="
    width: 50%;
">
            <img class="d-none d-lg-block" width="120px" height="auto" style="margin-right: 50px; margin-right: 50px;" src="/img/website_audits.png" alt="">

            <div>
              <h4 class="fw-bold mb-0 mobile-text"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-browser-chrome mobile-icon" viewBox="0 0 16 16">
                  <path fill-rule="evenodd" d="M16 8a8.001 8.001 0 0 1-7.022 7.94l1.902-7.098a2.995 2.995 0 0 0 .05-1.492A2.977 2.977 0 0 0 10.237 6h5.511A8 8 0 0 1 16 8ZM0 8a8 8 0 0 0 7.927 8l1.426-5.321a2.978 2.978 0 0 1-.723.255 2.979 2.979 0 0 1-1.743-.147 2.986 2.986 0 0 1-1.043-.7L.633 4.876A7.975 7.975 0 0 0 0 8Zm5.004-.167L1.108 3.936A8.003 8.003 0 0 1 15.418 5H8.066a2.979 2.979 0 0 0-1.252.243 2.987 2.987 0 0 0-1.81 2.59ZM8 10a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"></path>
                </svg>WEBSITE AUDITS</h4>
              <p class="d-none d-md-block">Looking to improve your page performance, SEO, or user experience? Reques a
                free site audit.</p>
            </div>
          </div>

        </div>

输出为移动的视图496px * 508px:

相关问题