Adding a white block in front of a background color with Bootstrap

I'm attempting to utilize bootstrap in order to create a section that resembles this design: View Example

The issue I am encountering is the white block in the center overlaying the green background. When I add an additional class to the outermost div (padding), nothing appears, but when added to any of the other divs, it only covers the image and text rather than filling the entire padding height. I have experimented with z-index: 999 along with a width of 80% and height of 100%, yet it distorts the background.

I am uncertain about what steps to take next. Any guidance would be greatly appreciated. Thank you.

HTML:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
        <link href="index.css" rel="stylesheet"/>
    </head>
    <body>
    <div class="padding attractionPad">
        <div class="container attractionContainer">
            <div class="row">
                <div class="col-sm-6">
                    <img src ="img2.png">
                </div>
                <div class="col-sm-6">
                    <ul class="attraction">
                        <li><h3>Ninja Course</h3></li>
                        <li><h3>Indoor Bounce Arena</h3></li>
                        <li><h3>Mechanical Wipeout Challenge</h3></li>
                        <li><h3>Ziplining Fun</h3></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    </body>
</html>

CSS:

html,body{
    background-color: #EE870D;
    width:100%;
    height:100%;
}
.padding{
    padding: 80px 0;
}
.padding img{
    width:100%;
}
.attractionPad{
    background-color: #8FBA51;
}
.attraction{
    color:blue;
    list-style:none;
}
.events li, .attraction li{
    margin: 10px 0 50px 0;
}

Visit Here for Demo

Answer №1

If you're leaving a comment, make sure to include this CSS in the .attractionContainer, as this container holds your content (row).

If you're aiming for the "desired look," you'll need to eliminate the padding CSS.

html,body{
background-color: #EE870D;
width:100%;
height:100%;
}
.padding{
padding: 0px ;
}
/* Remove the class or this CSS */
.padding img{
width:100%;
}
.attractionPad{
background-color: #8FBA51;
}
.attraction{
color:blue;
list-style:none;
}
.events li, .attraction li{
margin: 10px 0 50px 0;
}
.attractionContainer{
  background-color: #fff;
}

Answer №2

To achieve a fully responsive and centered layout, you can use the following code snippet:

html,
body {
  background-color: #EE870D;
  width: 100%;
  height: 100%;
}

.padding {
  padding: 80px 0;
}

.padding img {
  width: 100%;
}

.attractionPad {
  background-color: #8FBA51;
}

.attraction {
  color: blue;
  list-style: none;
}

.events li,
.attraction li {
  margin: 10px 0 50px 0;
}

.attractionContainer {
  background: #fff;
  height: 100vh;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>

<div class=" attractionPad">
  <div class="container attractionContainer d-flex">
    <div class="row align-self-center">
      <div class="col-sm-6 ">
        <img class="img-fluid" src="https://www.akberiqbal.com/Jumbo.jpg">
      </div>
      <div class="col-sm-6">
        <ul class="attraction">
          <li>
            <h3>Ninja Course</h3>
          </li>
          <li>
            <h3>Indoor Bounce Arena</h3>
          </li>
          <li>
            <h3>Mechanical Wipeout Challenge</h3>
          </li>
          <li>
            <h3>Ziplining Fun</h3>
          </li>
        </ul>
      </div>
    </div>
  </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

When you hover over a div, the image will automatically change

Although this issue has been brought up multiple times in the past, I have yet to find a satisfactory solution for my particular needs. The challenge lies in wanting to change the src of an image when hovering over a div, rather than the image itself. &l ...

Determine Checkout Total with Laravel 5.2 Based on Radio Button Selections

Currently, I am developing an e-commerce platform using Laravel 5.2. At the moment, I am able to add products to my shopping cart, which is stored in a session. Once I am ready to proceed, I can view my shopping cart and upon confirmation, I am directed t ...

Tips for incorporating a Python script into a online project

I've been working on a Python code that detects faces and eyes using face recognition. When the code runs in PyCharm, it displays a camera window. Now I'm trying to figure out how to integrate this window into a webpage project written in HTML, C ...

What's the best way to create placeholders in a string that can later be replaced by selected dropdown values through interpolation?

Currently, I'm working on utilizing binding in Angular2 to dynamically replace specific placeholders throughout my web app form with a selected name from a dropdown menu. This allows for a personalized user experience where the placeholders display th ...

Adjust the CSS to give <a> elements the appearance of plain text

Is it possible to style an anchor tag to appear identical to plain text? Consider the following scenario: <p> Here is some text and here is a <a class='no-link' href="http://www.example.com" >link</a></p> I have atte ...

yeoman / cssmin - Reduce the size of CSS files without combining them

Currently, I am developing a web application using the yeoman webapp generator. In my project, I have two scss base files - one is my standard file called main.scss and the other is for old Internet Explorer versions named main-old-ie.scss. I found this te ...

Implementing Dynamic Checkbox Selection using JavaScript

Could someone please assist me with this coding challenge? HTML <div id="toggle"> <ul> <li class="active"><input type="checkbox" id="test" value="2014" name="test" checked/> 2014</li> <div style="display:block;" id ...

Adapting the colors of the MUI Switch component

I am currently utilizing the switch component from MUI and I am looking to change the styling between two different colors. <Switch color={dataType === "expenses" ? "error" : "secondary"} onChange={handleOnSwitch} che ...

Anchors that need to be clicked multiple times before activating

'I recently encountered a strange bug. My CSS3 anchors/buttons, which I have been simplifying by removing properties, sometimes require multiple clicks to function. This is completely new to me and quite perplexing. The issue seems to occur randomly, ...

Locate the data attribute and store it in the database using an ajax request

I am in need of a proper script to insert a data attribute into the database upon clicking using ajax. HTML: <li><a data-cat="random name">Button</a></li> jQuery: $('li a').click(function() { $(this).data('cat&a ...

Struggling to achieve a horizontal scroll using 'overflowX' in MUI, but unfortunately, it's not functioning as expected

Is there a way to create a properly-sized card with a horizontal scrollbar in a paper format? I've tried using 'overflow' but it doesn't seem to be working in this scenario. import React from 'react'; import { makeStyles } fro ...

choose several options simultaneously

<select class="form-control default-select2 " id="group" data-size="10" data-live-search="true" data-style="btn-white" multiple="multiple"> <option value="" disabled="disabled" selected="selected">Choose Group</option> <!-- <o ...

What could be causing jQuery to successfully animate the size of my div element but not the color of my text?

My jQuery code successfully animates the height and width of divs, but it doesn't seem to be working for the text color within those divs. I'm not sure what I'm missing here. Below is the full code snippet, with lines 9 and 12 being the ones ...

What causes elements in a floating position to remain stationary when the element is scaled down?

Everyone: If I have three DIVs sitting in the same row, each with a width of 33% and height of 100%, and I decide to use transform: scale(0.5) to zoom out the first one, why does the second one not move left as expected? Any ideas on how to make it work? ...

The challenge with using prepared statements in PHP/MySQL for inserting data into a form

Recently, I encountered an issue with the code below that takes information from a form and sends it to MySQL. Previously, everything was working fine for category, contents, date, and user ID fields. However, after adding a new column called 'secleve ...

When the anchor tag is clicked, I'm displaying the DIV for Customer Testimonials, however, the expansion of its height is not

One way to display customer testimonials is by using flexslider to create a horizontal scroll. The testimonials are hidden and only shown when the "view all testimonials" link is clicked, which can be seen in this JSFiddle example: Working : Demo JQuery ...

I'm experiencing difficulties with JS on my website. Details are provided below – any suggestions on how to resolve this issue

Can someone help me with a web project issue I'm facing? Everything was going smoothly until I tried to add some JS for dynamic functionality. However, when I attempt to access my elements by tag name, ID, or class, they always return null or undefine ...

Navigating an HTML table with Selenium and Python by scrolling down

I am currently working on a project where I need to automate scrolling down an HTML table until the last row becomes visible. The table initially displays around 20 rows and then loads more as one scrolls down. To achieve this task, I am using Selenium web ...

Rearranging div placement based on the width of the screen

I am currently working on building a responsive website and I need two divs to switch positions depending on the screen width, both on initial load and when resizing. Despite my efforts in researching and trying various options, I have not been successful ...

chosen problem concerning jquery

My objective is to transfer li elements from one container to another container when the user clicks on the li span. I have a choices container and a choices display, so when a user clicks on the li span with the id of "add" in the first container, the r ...