html - 我想要没有容器流体的完整 div 但不改变容器宽度和结构?

标签 html css bootstrap-4

我想要完整的 div 没有 container-fluid 但不改变容器宽度 我想要容器宽度固定因为我的另一个 div 想要在容器中所以.结构也不会改变我想要这个结构。

.main {
   padding: 100px 0;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<section class="main">
    <div class="container">
        <div class="row"></div>
        <div class="col-12">
           <div class="half">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries</div>
           <div class="full">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries</div>
        </div>
    </div>
</section>

提前致谢

最佳答案

Try this it will be worked fine for you, i have added some CSS

.main {
   padding: 100px 0;
}

.full{
  background:red;
  width: 100vw;
  position: relative;
  margin-left: -50vw;
  left: 50%;
  padding:0 25px 
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<section class="main">
    <div class="container">
        <div class="row"></div>
        <div class="col-12">
           <div class="half">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries</div>
           <div class="full">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries</div>
        </div>
    </div>
</section>

关于html - 我想要没有容器流体的完整 div 但不改变容器宽度和结构?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57248525/

上一篇::not(:has(td[rowspan]))? 的 CSS 选择器

下一篇:html - Angular 在单击按钮时为整个页面内容设置动画

相关文章:

html - form 和 div html 元素的默认 css 参数

java - 获取 http://localhost:8080/resources/css/index.css net::ERR_ABORTED 404

html - css SVG 背景 - 周围奇怪的透明线

css - 使用 css/html 调整 div 的大小,但有一个问题

google-analytics - 如何获取GTM的内置YouTube触发器,以在通过JS点击功能创建的模式下播放的视频上触发

twitter-bootstrap - Bootstrap 定制发生了什么?

java - 使用 HTMLUnit 以编程方式使用 Java 登录 Facebook

JavaScript 表单验证仍然在 'False' 上提交表单

html - 在CSS中使用Background-image属性进行背景图像模糊处理

php - 调整图像大小时它不保持比例?