gpt4 book ai didi

html - 将 div 拉伸(stretch)到固定宽度元素内的全宽

转载 作者:行者123 更新时间:2023-12-04 10:32:39 29 4
gpt4 key购买 nike

关闭。这个问题需要details or clarity .它目前不接受答案。












想改进这个问题?通过 editing this post 添加详细信息并澄清问题.

2年前关闭。




Improve this question




我有一个博客页面,我正在使用 col-md-8 , 里面 col-md-8我的内容存在,但我想将我的一个 div 拉伸(stretch)到 col-md-8 中的全宽.我的页面

enter image description here

我想让它拉伸(stretch),
我的代码:

.joinUs {
width: 100vw;
margin-left: -33.333333%;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<section>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="article--publishedDate smallText text-uppercase">
Published : 02 June 2019
</div>
<div class="article--topDescription mt-54px">
In the above video, I have talked about top font management apps for Windows and Mac OS. Most of the Windows Font Management apps are Free and for Mac most of them are paid. I have talked about the top apps for Windows and Mac.
</div>

// I wanna make it stretch to full width of the browser
<div class="joinUs">
<div class="row">
<div class="col-md-8">
<div class="sectionTitle allCaps-Bold">
<span>Start learning for FREE Today - Visual Design Class</span>
</div>
</div>
<div class="col-md-4">
<div class="joinUs--title">
Join my community of <span>41257</span> students from <span>170</span> countries worldwide.
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>


但它不起作用

enter image description here

请帮帮我,我卡住了

最佳答案

检查这个。希望这可以帮助。
有两种方法可以实现这一点,

  • 负边距和大众宽度
  • 内容在一个固定的容器中,但让 :before :after 达到全 Angular 效果。 ( 蓝一号 )


  • /*Container style is for illustration purpose only */

    .container {
    background: gray;
    min-height: 400px; margin-bottom: 100px;
    }


    /*Can achive using vw css unit*/
    .row-full {
    width: 100vw;
    position: relative;
    margin-left: -50vw;
    height: 100px;
    margin-top: 100px;
    left: 50%;
    }

    /*<!--- 2nd way --> */

    .content_box {
    padding: 54px 0 21px;
    color: #fff;
    background-color: #88bae1;
    margin-bottom: 145px;
    position: relative;
    z-index: -1;
    }
    .content_box:before {
    content: "";
    position: absolute;
    height: 100%;
    left: -3000px;
    right: -3000px;
    background-color: #88bae1;
    z-index: -1;
    top: 0;
    bottom: 0;
    width: auto !important;
    }
    <div class="container">

    <div class="row" style="height:100px; background: #fff;"> this is ok</div>
    <div class="row row-full" style="height:100px; background: #f00;">
    this should take 100% width
    </div>
    </div>


    <!--- 2nd way -->


    <div class="content_box">
    <div>Lorem ipsum</div>
    </div>


    解决您的问题
    .joinUs:before {
    content: "";
    position: absolute;
    height: 100%;
    left: -3000px;
    right: -3000px;
    background-color: #ebf0f8;
    z-index: -1;
    top: 0;
    bottom: 0;
    width: auto !important;
    }

    body{overflow-x: hidden;}

    关于html - 将 div 拉伸(stretch)到固定宽度元素内的全宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60338217/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com