【发布时间】:2020-01-21 19:56:09
【问题描述】:
我创建了这个 codepen 来展示它使用 .container-fluid 的样子:
https://codepen.io/r3plica/pen/xxbmxvv
body {
background-color: gray;
}
.img {
border-radius: 50%;
position: absolute;
width: 15vw;
top: 50px;
right: -7.5vw;
z-index: 10;
border: 20px solid black;
}
.col-md-4 {
background-color: pink;
}
.col-md-8 {
background: rgb(148,87,232);
background: linear-gradient(90deg, rgba(148,87,232,1) 13%, rgba(98,252,241,1) 85%);
}
.col-md-4,
.col-md-8 {
padding-top: 50px;
padding-bottom: 50px;
}
p {
margin: 0 0 1rem 8rem;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
<img class="img" src="data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%22200%22%20height%3D%22200%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20200%20200%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%23holder_16fc7a75ec3%20text%20%7B%20fill%3Argba(255%2C255%2C255%2C.75)%3Bfont-weight%3Anormal%3Bfont-family%3AHelvetica%2C%20monospace%3Bfont-size%3A10pt%20%7D%20%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_16fc7a75ec3%22%3E%3Crect%20width%3D%22200%22%20height%3D%22200%22%20fill%3D%22%23777%22%3E%3C%2Frect%3E%3Cg%3E%3Ctext%20x%3D%2274.421875%22%20y%3D%22104.5%22%3E200x200%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E" />
</div>
<div class="col-md-8">
<p>There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here.</p>
<p>There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here.</p>
<p>There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here. There should be a fair amount of content here.</p>
</div>
</div>
</div>
问题是,我的客户不希望它是流体宽度;他希望它的宽度为 1140 像素(在大屏幕上),但他希望让渐变保持从 .col-md-8 开始到最右侧的整个宽度。
如果您查看代码笔,则有 2 列。第二列的渐变一直到视口的边缘。他想要一个容器宽度,但仍然希望渐变一直到边缘。如果我做了一个具有设定宽度的容器,它不会。我希望这是有道理的。
这可能吗?
【问题讨论】:
-
'他想保持渐变跨越整个宽度'这是什么意思?
-
呃,链接不见了。一秒
-
我做了一个sn-p,不需要链接。将代码保留在此处,以便所有人都能轻松使用,可以编辑 Codepend,整个问题将无关紧要
-
sn-p 显示不正确
-
所以编辑 sn-p 然后如果你想避免你的问题被关闭
标签: html css bootstrap-4