I am having trouble keeping my containers from overlapping

I have used bootstrap to create the following design:

https://i.sstatic.net/1yqKI.jpg

Here is the code for the design shown above:

<div class="jumbotron cta-header">
    <div class="container cta-intro-box">
        <h1 class="cta-heading-text">testing testing testing </h1>
    </div>
</div>

.cta-header {
z-index: 3;
position: relative;
background-size: cover;
height: 100vh;
padding: 160px 0;
top: 0;
left: 0;
width: 100%;
float: left;
}

However, when I tried adding a section below this screen, it seems to be overlapping as seen in the image here:

https://i.sstatic.net/e6Byt.png

The code for the conflicting "section" is as follows:

<div class="container">
<div class="row">
<h2 class="cta-container-header">services</h2>
    <div class="col-lg-4 cta-align">
      <h2 class="cta-service-text">Front-End web development</h2>
      <p class="cta-service-p">test paragraph</p>
    </div><!-- /.col-lg-4 -->
    <!-- /.col-lg-4 -->
    <!-- /.col-lg-4 -->
  </div>
</div>

.container {
position: absolute;
width: 1170px;
}

The container is not supposed to overlap with the other content. I attempted to change the positioning and use margin-top, but it did not resolve the issue. I want the sections to stack vertically like building blocks instead of overlapping.

Answer №1

Why have you chosen to use properties like absolute and float in certain cases? Perhaps there is a more optimal solution that we could explore.

View working fiddle

<div class="jumbotron cta-header">
    <div class="container cta-intro-box">
        <h1 class="cta-heading-text">testing testing testing </h1>
    </div>
</div>

<div class="container">
<div class="row">
<h2 class="cta-container-header">services</h2>
    <div class="col-lg-4 cta-align">
      <h2 class="cta-service-text">Front-End web development</h2>
      <p class="cta-service-p">test paragraph</p>
    </div><!-- /.col-lg-4 -->
    <!-- /.col-lg-4 -->
    <!-- /.col-lg-4 -->
  </div>
</div>

.container {
width: 1170px;
}

.cta-header {
background-size: cover;
height: 100vh;
padding: 160px 0;
}

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

Improving Vue Component on Navigation

I am facing an issue with my navbar where I have two versions. Version 1 features a white text color, while Version 2 has black text. The need for two versions arises due to some pages having a white background, hence the requirement for black text. Bot ...

transfer text from one input field to all others

Here is my customized form <form id=form1 method=post accept-charset=UTF-8 action=> <input type=hidden name=video_id[0] value=K94KNsN43BU><p>Title<br> <textarea rows=1 cols=40 id=title_0 name=title[0]>custom title ...

Modify a section of text in iOS by swapping it with a new

In my string, I have the following HTML code - <html> <head> </head> <body> <p>***Some Text***.</p> <p><iframe allowfullscreen="" frameborder="0" height="360" src="//www.some-domain. ...

Ways to target other links exclusively during hover effect on a single link

I've been attempting to shrink all other links when one link is hovered over, but I'm only able to make the links after the hovered one shrink. .navlink { width: 100px; display:inline-block; background-color: red; } .navlink:hover~.navl ...

Exceeded maximum file size event in Dropzone

I am currently implementing dropzone in my form to allow users to upload images. In the event that a user selects a file that exceeds the configured limit, I want to display an alert message and remove the file. Below is my current configuration: Dropzone ...

I am experiencing issues with the functionality of the Search Button in my code

I am experiencing an issue with the Search Button in my Search Form. I created the Search form using only html and pure CSS to test whether JS is necessary for a Search form with Drop Down Filter! Do I need to incorporate some JS code or is it feasible to ...

verified that all form checkboxes were selected in angularJS

Hey there, I have a form in AngularJS with multiple checkboxes. When the first checkbox (Check All) is clicked, I want all the checkboxes to be checked. How can I achieve this using Angular for each field loop? Below is a snippet of my code: vm.asas = f ...

Is there a way to automatically input an array of elements into a form without having to do it manually

Is it possible to create a form using an array of items fetched from a database, and automatically populate the form with each of these elements? Currently, I'm facing difficulties as the form appears empty. What am I missing? Below is the code I ha ...

adjust the @page rule size for different classname matches during printing

I am attempting to adjust the @page rule size based on matching classnames, however, my research has only led me to pseudo-classes which do not seem to solve my issue. Here is a snippet of my CSS: @media print { @page { margin: 13.2mm 0mm 12.9mm; ...

Unable to modify jwplayer css styles to customize the chromecast icon

Is there a way to customize the chromecast icon within the JWPlayer skin to have a specific color? I've identified that the styles I need to change are --connected-color and disconnected-color when inspecting the element. Despite my attempts through ...

Troubleshooting HTML navigation bar white space problem

I am encountering a white space issue with my HTML nav bar for the first time. I have managed to fix the space on the sides (left and right), but there is still some space at the top of the nav bar. Can someone please assist me in resolving this issue? To ...

Creating an event listener using a calendar icon

I am looking to create a custom datepicker <input type="text" name="Birth" id="calendarInput" required class="inputField" placeholder="31.12.2001"> <input type="date" name="Birth&qu ...

Add CSS properties to child elements that are not of a specific selector, while styling their descendants without any restrictions

Seeking assistance for an Angular application, but the query also pertains to CSS principles in general. In my Angular project, I have a main component containing several child components, all with standard view encapsulation. Specifically, I am looking t ...

Google Chrome extension with Autofocus functionality

I developed a user-friendly Chrome extension that allows users to search using a simple form. Upon opening the extension, I noticed that there is no default focus on the form, requiring an additional click from the user. The intended behavior is for the ...

Error with displaying uib-datepicker within a table row

I need assistance with integrating a uib-datepicker into a table: <div class="table-responsive"> <table class="table table-striped" > <thead> <tr> <th class="col-md-2"><span>Date ...

Issue with Jquery functionality in Sharepoint Script Editor

I'm currently working on a project where I need to showcase a SharePoint list within a Bootstrap data table. While the list is being displayed correctly, I encountered an issue when I added the class for Bootstrap data tables - the table did not show ...

Can anyone provide guidance on how to trigger 3 unique functions in a specific order using JavaScript?

I've been troubleshooting this issue for quite some time, but I just can't seem to figure it out. Here's my dilemma: I have three functions - one to shrink a div, one to reload the div with new data, and one to enlarge the div - all triggere ...

Modal window closed - back to the top of the page

I am struggling with a simple modal popup window that does not maintain the scroll position when closed, instead returning you to the top of the page. I am looking for a way to keep it at the same scroll position without much knowledge of Javascript. You ...

Disregard the Margin of Ancestor Elements

I'm attempting to make an image span the full width of a parent element, but the parent element has a margin of 10px. This means that when I apply #parent img { position: absolute; top:0; left:0; height: auto; width: 100% } It on ...

How to center align SVG with text in a unique way

Having trouble vertical aligning my inline SVG within a label. Any suggestions? This is how I've attempted it: <label for="menu-check-box">More<svg class="more-icon"><use xlink:href="#more-chevron"></use></svg></labe ...