Content escapes its parent container and seamlessly transitions to the following element

I am facing an issue with the layout of my element, which includes an image and text centered inside a parent container.

Whenever I try adding more elements below the existing image and text, the green text with a red border overflows the current parent .about and moves to the next parent .contact-us.

To see and modify the code, you can visit this fiddle link: https://jsfiddle.net/04rmefx7/

Here is the provided code snippet:


body,
html {
  height: 100%;
}

.inline-block {
  display: inline-block;
}

/* Styles for about section */
.about {
  background-color: #dad04a;
  position: relative;
  height: 100%
}
.about img {
  height: 100px;
}
p{
  border: 4px solid red;
  color: green;
  font-weight: bold;
}

/* Styles for contact us section */
.contact-us {
  background-color: #eeb03c;
}

<!-- HTML structure -->
<link href="https://getbootstrap.com/docs/3.3/dist/css/bootstrap.min.css" rel="stylesheet">

<!-- About Section -->
<div class="about text-center">
  <div class="inline-block">
    <img class="pull-left" src="https://placehold.it/600">
    <div class="pull-left text-left">
      <h4 class="inline-block">Heading</h4>
      <span>Lorem ipsum dolor sit amet</span><br>
      <span>Lorem ipsum dolor sit amet</span><br>
      <span>Lorem ipsum dolor sit amet</span><br>
      <span>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</span><br>
      <span>Lorem ipsum dolor sit amet</span>
    </div>
    <div class="clearfix"></div>
  </div>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Et velit officia alias harum nam illum pariatur deleniti reprehenderit, aliquam, commodi iure modi, facilis error dolorum doloribus. Porro, hic explicabo dolores. Lorem ipsum dolor sit amet,
    consectetur adipisicing elit. Dolore dolor explicabo quas, est, iure non repellendus eaque, nemo eum repudiandae voluptatem rem quos iste a. Non nisi aliquid consequuntur. Libero!</p>
</div>
<!-- End of About Section -->

<!-- Contact Us Section -->
<div class="contact-us text-center">
  <h2>Contact us</h2>
</div>
<!-- End of Contact Us Section -->

Answer №1

Have you tried removing the height: 100% property from the .about class?

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

How do I directly display a variable in index.html using node.js?

Is there a way to retrieve user inputs from the index.html file, process them in Node.js, and then display the result back on the index.html page instead of redirecting to a new page? Form Handling with Express var express = require('express'); ...

The Wonders of Flex Box and Media Queries

Can a website still be made responsive without relying on media queries when flexbox is already implemented? Are there specific scenarios where the utilization of media queries offers enhanced control? ...

What could be the reason behind the failure of my inner div to successfully implement the flex-row

I'm currently trying to position two divs next to each other horizontally, and my concept was to utilize flexbox, but including the property flex-row doesn't seem to yield any results and I can't comprehend the reason behind it. How can I a ...

The array is producing accurate results, however it is displaying as undefined in the HTML output

I have encountered a problem while working on my project. I am utilizing an API to fetch an array of platforms where a video game is available. Although the array is returning the correct data, I am facing difficulty in displaying these values in my HTML a ...

Positioning an element absolutely inside a Material-UI React dialog

Currently, I am working on a Dialog component that includes a button located in the bottom right corner. When this button is clicked, it triggers the display of another div containing a list of items. However, I have encountered an issue where the list is ...

Having trouble with Jquery not working, and I'm stumped trying to solve it

I wrote this function but I can't figure out why it's not working. The JS file is being loaded because other functions inside it are functioning properly, but those with this specific format aren't: $(function () { .... }); The intention ...

How to create a full-width and full-height background image in a div using CSS

When using a bootstrap template, I encountered an issue with adding an image as a background. Here is the CSS code: background:url(../images/banner.png) no-repeat; background-size: 100%; The problem with these CSS rules is that the image gets clipped and ...

In-depth preg_match_all analysis

I'm encountering an issue with my detailed preg_match_all not working as expected. Instead of retrieving the desired data, I am getting a blank Array. Below is the code snippet I'm struggling with: <?php $remote_search = file_get_content ...

Unlimited scrolling feature in Ionic using JSON endpoint

Trying to create an Ionic list using data from a JSON URL. JSON Code: [{"id":"1","firstName":"John", "lastName":"Doe"}, {"id":"2","firstName":"Anna", "lastName":"Smith"}, {"id":"3","firstName":"Peter", "lastName":"Jones"},{......................}] app.j ...

Numerous volume sliders catering to individual audio players

I'm currently working on implementing volume sliders for multiple audio players, similar to what you can find on . With the help of Deepak, I've managed to create code that allows me to control play/pause and adjust the volume of various audio pl ...

Capturing variable data without retaining the information entered

I recently received some code that seems to be malfunctioning, and I'm struggling to pinpoint the issue. The code in question involves a hyperlink (.control_button) that triggers the opening of a form (#convert-form) within a lightbox. Within this for ...

Can someone help with the issue where the CSS field position changes when the "X" icon appears, as mentioned in the title? I am looking for a solution to fix this problem

When trying to add an additional field on a page, the "X" icon appears inline with the field and causes the other fields to adjust their position. However, I want the new field to remain in the same position as the title. How can I achieve this while keepi ...

Ways to align text within a table cell on a background using CSS

I'm attempting to print jukebox strips with designated corner markings. The code I have written generates the HTML page for displaying the strips, allowing users to then print them. Jukeboxes typically feature selection buttons labeled ABCDEFGHJK and ...

Improving Performance of a Large Unordered List using JavaScript

My website currently features a search box that retrieves images and displays them in a list format. Each image has an associated click event that triggers an overlay on the parent li element when clicked. However, with search results exceeding 300 images ...

Error Message Design in ASP.NET

I am currently developing a website using .net, which is a new technology for me. Here is the snippet of code I am working with... <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ValidationGroup="V1" Display="Dynamic" ...

What could be causing my content to not appear in grids? (React.js)

I'm currently following Hamza Mirza's React tutorial on YouTube to create a movie search app. I'm having trouble displaying the movie results in columns and grids, even though I'm using a different API for this specific project. Here i ...

Modifying the value of an animated status bar using the same class but different section

I need the status bars to work individually for each one. It would be great if the buttons also worked accordingly. I have been trying to access the value of "data-bar" without success (the script is able to process the "data-max"). However, the script see ...

Navigating pages in tinymce editor

Currently, I have implemented TinyMCE as the editor for my PHP-based website. However, I am facing a challenge in integrating pagination within the editor. My goal is to allow users to input long content that will be displayed across multiple pages inste ...

Determine if a div contains an svg element with JavaScript

My question involves a div containing a question mark and some SVG elements. Here is the initial setup: <div id="mydiv">?</div> When validating a form submission in my code, I check if the div text contains a question mark like this: const f ...

Duplicate multiple "li" elements using jQuery and place them in a designated position within the ul element, rather than at the end

I am currently working on developing a dynamic pagination bar. This pagination bar will dynamically clone the "li" elements based on a number received from an external webservice. Here is the structure of my pagination element: <ul class="pagination"& ...