html - 带背景颜色的 Bootstrap 全宽侧边栏

标签 html css twitter-bootstrap

我的布局如下 this image

问题?如何在左侧部分制作全 Angular 紫色背景? 这是my code

HTML:

<section id="screens-eight" class="clearfix">
    <div class="container">
        <div class="row">
            <div class="col-md-6 screens-eight-left">
                <div class="screens-eight-bg"></div>
                <p>
                    Ut Enim ad minim veniam quis nostrud exercitation ullamco laboris. Nisi ut aliquip ex ea commodo
                </p>
            </div>
        </div>
    </div>
</section>

CSS:

#screens-eight {
    background: blue; 
    padding-bottom: 180px;
}
.screens-eight-left {
    background: #835fa8; 
    position: relative; 
    z-index: 0; padding-bottom: 
    80px; padding-top: 80px;
}

@media(min-width: 992px) {
    .screens-eight-left .screens-eight-bg {
    background: #835fa8; 
    left: 0; position: 
    absolute; top: 0; 
    width: 50%; 
    z-index: -1;}
}

最佳答案

我在本地计算机上找到了解决方案。只需按照以下步骤操作即可。

HTML

<section id="screens-eight" class="clearfix">
        <div class="container">
            <div class="row">
                <div class="col-md-6 screens-eight-left">
                    <p>
                        Ut Enim ad minim veniam quis nostrud exercitation ullamco laboris. Nisi ut aliquip ex ea commodo
                    </p>
                </div>
            </div>
        </div>
    </section>

CSS

    #screens-eight {background: blue; padding-bottom: 180px;}
.screens-eight-left {position: relative; z-index: 0; padding-bottom: 80px; padding-top: 80px;}

@media(min-width: 992px) {
    .screens-eight-left .screens-eight-bg {background: #835fa8; left: 0; position: absolute; top: 0; width: 50%; z-index: -1;}
}

** 现在在 Photoshop 中制作 1 个图像**

第 1 步:- 创建高度为 1PX、宽度为 3000PX 的新图像 步骤 2:- 用颜色代码 #835fa8 填充左侧部分的 50%。所以你左边 50% 的部分是这种颜色 #835fa8,右边 50% 的部分是空白(透明)。 第 3 步:- 现在将图像保存为 png 格式。

现在在此 ID="screens-8"中调用该 png 图像

所以你必须添加CSS

#screens-eight {
    background-image: url(line.png);
    background-position: center;
    background-repeat-y: repeat;
}

所以现在你更新的CSS将如下

#screens-eight {background: blue;
    background-image: url(line.png);
    background-position: center;
    background-repeat-y: repeat;
    padding-bottom: 180px;
}
.screens-eight-left {position: relative; z-index: 0; padding-bottom: 80px; padding-top: 80px;}

@media(min-width: 992px) {
    .screens-eight-left .screens-eight-bg {background: #835fa8; left: 0; position: absolute; top: 0; width: 50%; z-index: -1;}
}

我还上传了我创建的图像,以便您了解想法。 enter image description here

关于html - 带背景颜色的 Bootstrap 全宽侧边栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36168778/

相关文章:

javascript - 网站自动登录是如何实现的?

html - 不同页面中的不同类在 css 中具有相同的信息

asp.net - Ajax 日历扩展器在底部被切断

css - 将两个 .less 文件合二为一

html - 如何让我的内容集中在这个响应式 div 中?

html - 更改 Bootstrap 导航栏中每个元素之间的空间

html - MkDocs 中的全局变量

javascript - 非 angularJS 页面到 angularJS 页面,反之亦然。从非 Angular 到 Angular 渐进转换

css - 文字适合图像大小

javascript - 重命名 Bootstrap 生成的标签