What could be causing the issue of the CSS not displaying properly behind my black writing container, resulting in a clash of colors

When I tried using a z-index of 99 and setting a black background color, I expected the clouds CSS to be hidden behind the #writing-container.

To my surprise, the clouds were visible through the container, but were positioned behind the text. While the text was visible, there seemed to be a clash happening.

Adding a black background-color to my #ph-p-container achieved the desired effect of hiding the cloud behind the black background. However, this logic did not work for the entire #writing-container.

I could separate different black backgrounds for each container, but the outlines of the black rectangles appeared unprofessional.

Is there a way to prevent the clouds from being visible through the entirety of the #writing-container?

https://codepen.io/jake-matthews/pen/wvQMaEO

.page-hero {
  background-color: black;
  height: 825px;
  color: white;
  display: flex;
  align-items: center;
  overflow-x: hidden;
  flex-wrap: wrap;
  width: 100%;
  z-index: 2;
  position: relative;
}

#writing-container {
  margin-left: 175px;
  margin-bottom: 160px;
  background-color: black;
  position: relative;
  /* Add this */
  z-index: 99;
  /* Add this */
}

#ph-p-container {
  width: 60%;
  position: relative;
  background-color: black;
} ... 
...

Answer №1

Why not add a dash of imagination to the #writing-container area?

.page-hero {
  background-color: black;
  height: 825px;
  color: white;
  display: flex;
  align-items: center;
  overflow-x: hidden;
  flex-wrap: wrap;
  width: 100%;
  z-index: 2;
  position: relative;
}

#writing-container {
  margin-left: 175px;
  margin-bottom: 160px;
  background-color: black;
  position: relative;
  /* Include this */
  z-index: 99;
  /* And this */
}

#ph-p-container {
  width: 60%;
  position: relative;
  background-color: black;
}

#ph-h1-container {
  width: 80%;
  position: relative;
  overflow: visible;
}

#ph-h1-container h1 {
  font-size: 70px;
  margin-bottom: 33px;
  position: relative;
  display: inline-block;
}

.highlight {
  box-shadow: inset 0 -27.25px 0 rgb(255, 98, 0);
}

#page-hero-svgs {
  height: 50px;
  display: flex;
  align-items: center;
  margin-left: 20px;
  margin-bottom: 33px;
  position: relative;
}

.svg-icon {
  width: 50px;
  height: 50px;
  margin-right: 20px;
  transition: ease-in;
  fill: rgb(255, 98, 0);
}

.svg-icon:hover {
  fill: white;
  cursor: pointer;
  transition: ease-in 0.3s;
}


/* Clouds */

#background-wrap {
  height: 100%;
  width: 100%;
  padding-top: 50px;
  position: absolute;
  z-index: 0;
}

/* Let's Get Creative */

@-webkit-keyframes animateCloud {
  0% {
    margin-left: -1000px;
  }
  100% {
    margin-left: 100%;
  }
}

@-moz-keyframes animateCloud {
  0% {
    margin-left: -1000px;
  }
  100% {
    margin-left: 100%;
  }
}

@keyframes animateCloud {
  0% {
    margin-left: -1000px;
  }
  100% {
    margin-left: 100%;
  }
}

... (omitted for brevity) ...

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

Ways to style specific dates on a datepicker?

Is there a way to customize the appearance of the first and last selected days in my ui datepicker for booking, similar to the design shown in the image linked below? https://i.sstatic.net/bKnRS.jpg var dateFormat = "DD/MM/YY", ...

Temporarily assign a placeholder image for any broken image

Is there a way to display a default image instead of a broken image without changing the URL? I have created a template editor where users can input dynamic URLs for images. Initially, the image appears broken, but when the user sends it, the correct imag ...

Using SQL to Insert Values into Select/Option

I am attempting to create a select form element with predetermined options. <select name="select1"> <option value="value1">Value 1</option> <option value="value2">Value 2</option> <option value="value3">Value 3 ...

What is the fastest way to add an email subscription form to my website without needing to configure a database?

Would it be possible to integrate a sign-up text box on our site for users interested in receiving launch notifications? Any suggestions on the most effective method to implement this feature? EDIT: Our current use of Prefinery has limitations as we cann ...

How can we ensure that the entire BS4 Navbar (on smaller screens) is clickable, allowing users to show/hide the submenu by touching anywhere within the area?

https://i.sstatic.net/03po7.png My goal is to make the entire navbar area touchable, rather than just having a button. I believe this can be achieved by adjusting the default Bootstrap 4 navbar settings: HTML: <nav id="menu-navbar" class="navbar navb ...

Develop fresh JavaScript code using JavaScript

Is it possible to dynamically create a new row in an HTML table by clicking on a button? Each row contains multiple input fields. <script type="text/javascript> row = 2; specific_row_id = new Array(); $(document).ready(function() { $(".change_1 ...

Using a Key to Activate the Trigger Button Instead of a Mouse Click

I am seeking assistance with a specific issue. I currently have a timer with a stop button that can be clicked with a mouse, but I want to enable the button to also be activated via a key press. I have attempted different methods such as using document.add ...

Using JavaScript to fetch HTML and apply CSS dynamically

Is there a way to retrieve all HTML within a div along with the corresponding CSS? A majority of the CSS is defined in classes within an external stylesheet. document.getElementById("mydiv") Currently, using the above code only fetches the HTML with inli ...

Using jQuery to dynamically add or remove CSS classes to an element based on the selected radio button

Currently, I am attempting to utilize localstorage to save a class based on the selected radio button. Essentially, when the second radio button is clicked with the data-color attribute "color2", the goal is to apply that data as a class to the .box elemen ...

What is the reason for getAttribute not returning the name of the option field?

Here is the React code snippet that I'm working with: I need to fetch and store the key value on an option element when the select input is being changed. <select className={"select_1"} onChange={(event: React.ChangeEvent<HTMLSele ...

In Javascript, what does `$("a[href*='video']")` represent?

I find myself puzzled by this particular line of code: $("a[href*='video']"). It seems to hold an enigma that I can't quite unravel. $("a[href*='video']").click(function() { var id = $(this).attr("href"); playVideo(id); }) ...

Using jQuery and AJAX to submit a dynamic form

I am currently facing an issue with cloning a HTML drop down list using jQuery. The main problem I am encountering is that there seems to be no restriction on the number of cloned sections, and I need to store all these sections in a mySQL database. How c ...

How to assign a value to a textarea element in an HTML form?

I am struggling to populate a text area with the value using this code snippet... <?php $message = $_REQUEST['message']; ?> <br/><b>Description</b><br/> <TEXTAREA NAME="message" COLS=40 ROWS=6 value="<?=$messa ...

The line numbers are displayed in an unconventional manner next to the textarea

Creating a new text editing tool, here is the code snippet:- const editor = document.querySelector('#ta'); const lc = document.querySelector('#line-count'); var lcDiv = document.createElement('p'); // Function to calculate ...

an online platform design

I am currently working on building a webpage, but I am facing some issues with the layout. Specifically, I am unable to make the div automatically adjust its size (particularly the height). Here is the code that demonstrates the problem: <!DOCTYPE html ...

Is it possible to alter the color of an icon image using CSS?

I'm currently exploring ways to modify the color of an image that has a transparent and solid color split. My goal is to change the white portion for hover effects, and create a dynamic way to alter colors within WordPress without relying on Photosho ...

Top section of a table repaired

It seems that the position fixed attribute is not working as expected in this scenario. I might be missing something. I'm trying to keep the input boxes in the first row frozen when scrolling, but none of the solutions I've found seem to be effe ...

Embedding SVG or image code within the </style> tags is a common practice in web development

Can anyone assist me in placing this code within </style>? I am unsure of how to proceed with this. I believe the best approach would be to start by moving most of it into </style>, and then I can decide what should remain there. I would grea ...

The anchor is no longer functioning

Having just started with Javascript, I am facing some issues on my website... I have implemented the fullPage.js script along with another script for a vertical menu containing hidden submenus. However, the script for the navigation menu is not functioning ...

Is there a way to display error messages next to the input field in Bootstrap 4?

https://i.sstatic.net/0B1rM.png I am interested in changing the placement of error messages to the right side instead of the bottom of the "By" input element. Here is the code snippet: <div class="row "> <div class="c ...