search
HomeWeb Front-endCSS TutorialHow to Create a Full-Width Bootstrap Background with Transparent Overlays and Multiple Columns?

How to Create a Full-Width Bootstrap Background with Transparent Overlays and Multiple Columns?

Full-Width Bootstrap Background with Transparent Color Overlays and Multiple Columns

In Bootstrap 3, achieving a full-width background with transparent color overlays while maintaining multiple columns can be a challenge. To navigate this, you can leverage techniques outlined in previous inquiries and extend them to incorporate column elements.

The code demonstration provided in the Codepen example showcases the implementation effectively. Here's the relevant code snippet for reference:

<div class="container extra">
  <div class="row">
    <div class="col-sm-4 left"></div>
    <div class="col-sm-8 right"></div>
  </div>
</div>
.container {
  width: 50%;
  margin: auto;
  margin-top: 1em;
  position: relative;
  overflow: visible;
}

.extra:before {
  content: '';
  display: block;
  position: absolute;
  top: 0;
  left: 50%;
  width: 100vw;
  height: 100%;
  transform: translate(-50%, 0);
}

[class*="col"] {
  border: 2px solid grey;
  min-height: 120px;
  position: relative;
}

.left:before {
  content: '';
  position: absolute;
  height: 100%;
  width: 100vw;
  top: 0;
  right: 0;
  background: rgba(255, 0, 0, 0.5);
}

.right:before {
  content: '';
  position: absolute;
  height: 100%;
  width: 100vw;
  top: 0;
  left: 0;
  background: rgba(0, 0, 255, 0.25);
}

This approach involves creating an extra element with a class of 'extra' that serves as a container for the entire layout. Within this 'extra' element, you'll have the main content container with a class of 'container'. To position the colored overlays on top of the columns, you can utilize the ':before' pseudo-element on the 'left' and 'right' column classes, which allows you to add content before the actual content of the element. By setting the width and height of these pseudo-elements to 100vw and 100%, you ensure they cover the entire width and height of the columns. Finally, you can specify the transparent colors using the 'rgba()' function, where the last value represents the transparency level (0 for transparent, 1 for fully opaque).

The above is the detailed content of How to Create a Full-Width Bootstrap Background with Transparent Overlays and Multiple Columns?. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Just Sharing My GulpfileJust Sharing My GulpfileApr 13, 2025 am 10:00 AM

Seemingly out of the blue, the Gulp processing I had set up for this site started to have a race condition. I'd run my watch command, change some CSS, and the

A Handy Sass-Powered Tool for Making Balanced Color PalettesA Handy Sass-Powered Tool for Making Balanced Color PalettesApr 13, 2025 am 09:59 AM

For those who may not come from a design background, selecting a color palette is often based on personal preferences. Choosing colors might be done with an

Stream-Crossing ConfusionStream-Crossing ConfusionApr 13, 2025 am 09:57 AM

These are tongue-in-cheek, but there is a point to be made here. It's one challenge to understand a technology, and another challenge to understand how

Techniques for Rendering Text with WebGLTechniques for Rendering Text with WebGLApr 13, 2025 am 09:54 AM

As is the rule in WebGL, anything that seems like it should be simple is actually quite complicated. Drawing lines, debugging shaders, text rendering… they

Two Lessons I Learned From Making React ComponentsTwo Lessons I Learned From Making React ComponentsApr 13, 2025 am 09:51 AM

Here’s a couple of lessons I’ve learned about how not to build React components. These are things I've come across over the past couple of months and thought

How to Modify Nodes in an Abstract Syntax TreeHow to Modify Nodes in an Abstract Syntax TreeApr 13, 2025 am 09:50 AM

One of the more powerful concepts I've stumbled across recently is the idea of abstract syntax trees, or ASTs. If you've ever studied alchemy, you may recall

How to Stack Elements in CSSHow to Stack Elements in CSSApr 13, 2025 am 09:48 AM

If you want to create fantastic and unique visual experiences on the web, you will eventually need two elements to overlap or exist in the same place. You may

A Whole Bunch of Places to Consider Contrast in a Single ParagraphA Whole Bunch of Places to Consider Contrast in a Single ParagraphApr 13, 2025 am 09:46 AM

When we're thinking about choosing colors in design, we're always thinking about accessibility. Whenever colors touch, there is contrast and, if we're talking

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)