The div element is not expanding as expected, causing the content to overlap

In my code, I have a portfolio-container div with two images and paragraphs inside a list element. The issue I'm facing is that the div is not expanding vertically, causing the images and paragraphs to overlap with the footer below. I've attempted to use display: inline-block on various elements like sections, containers, lists, and images, but none of these solutions have resolved the problem.

/********************************************
PORTFOLIO
********************************************/

#portfolio {
display: inline-block;
}

.portfolio-header {
background-color: #0e2951;
color: #fff;
margin: 1em 0 0 0;
font-size: 1.5em;
padding: 0.1em 0.5em;
}

.portfolio-header.p {
margin: 0;
}

.portfolio-container {
margin: 0 0 1.5em 0;
background-color: red;
height:100px;
background-color: #3d7ddd;
}

.portfolio-container ul {
margin: 0;
list-style: none;
padding: 0;
}

.portfolio-container li {
width: 80%;
margin: 0 auto;

}

.portfolio-container li p {
margin: 0 0 1em 0;
background-color: #b1caf1;
}

.portfolio-image {
max-width: 100%;
margin: 0;
float: left;
}


/********************************************
FOOTER
********************************************/

footer {
border-bottom: solid 0.5em #0e2951;
background-color: #000000;
}

.contact-icon-box {
width: 33.333%;
float: left;
margin-top: 1.5em;
}
.contact-icon-link {
width: 1em;
margin: 0 auto;
text-align: center;
background-color: #3d7ddd;
color: #94b7ec;
border-radius: 150px;
font-size: 5em;
}
<section id="porfolio">
<div class="portfolio-header">
<p>Some of my recent work</p>
</div>
<div class="portfolio-container">
<ul>
<li><img class="portfolio-image" src="images/ZIC-screenshot.png" alt="ZIC Homepage"><p>ZIC Homepage</p></li>
<li><img class="portfolio-image" src="images/grafi-screenshot.jpg" alt="Javascript Interactive Graphs"><p>Interactive Js Graphs</p></li>
</ul>
</div>
</section>

<footer>
<div id="contact">
<div class="contact-icon-box">
<div class="contact-icon-link ion-social-facebook">
</div>
</div>
<div class="contact-icon-box">
<div class="contact-icon-link ion-ios-telephone">
</div>
</div>
<div class="contact-icon-box">
<div class="contact-icon-link ion-email">
</div>
</div>
</div>
</footer>

Answer №1

You may want to consider setting the height:auto for the portfolio-container

.portfolio-container {
    margin: 0 0 1.5em 0;
    background-color: red;
    height:auto;
    background-color: #3d7ddd;
} 

Answer №2

It appears that the elements within your portfolio-container are extending beyond the boundaries of the footer due to a restricted height setting on the container. This is causing the content to spill over downwards.

To resolve this issue, consider removing the fixed height restriction or implementing a min-height property instead.

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

Is it possible to incorporate a php file within .htaccess?

Can anyone provide guidance on how to include a PHP file using .htaccess? I've searched online but haven't been able to find a helpful tutorial or code. Below is the PHP include code that I have tried: <?php require('footer.php'); ...

Custom background options for Wordpress developer

I have been exploring the WordPress codex to learn about incorporating custom background options, similar to this example $defaults = array( 'default-color' => '', 'default-image' => '&apo ...

Ensuring that the text input is perfectly lined up with the submit button

Is there a way to solve this discrepancy? Solution: https://jsfiddle.net/6q352ysx/59/ The elements are currently the same height, but not aligned properly. https://i.stack.imgur.com/ajVyJ.png Which alignment option should I use? Option 1: vertical-ali ...

Hover over with your mouse to open and close the dropdown menu in React JS

Just starting out with React JS and encountering a small issue. I'm trying to make the menu disappear when the mouse leaves that area, so I used onMouseOut and onMouseLeave to close it. However, I noticed that having these options in place prevents th ...

How to properly display an Angular Template expression in an Angular HTML Component Template without any issues?

When writing documentation within an Angular App, is there a way to prevent code from executing and instead display it as regular text? {{ date | date :'short'}} Many sources suggest using a span element to achieve this: <span class="pun"&g ...

modifying input field with radio button selection in Jquery

Is there a way to set the input field to have a default value and then change it, or disable it with a different value? $("#tax").value(19).prop("disabled",false); $("#tax").value(0).prop("disabled",true); <script src="https://ajax.googleapis.com/aj ...

replace the standard arrow key scrolling with a new custom event

Currently, I am in the process of creating a unique scroll box to address my specific needs. The standard html <select> box is not cutting it for me as I require two columns displayed, which I couldn't achieve with a regular <select>. However, I ...

Expanding Two HTML Elements to Fill the Screen Width Using HTML/CSS

This is the current setup: The screenshot spans the width of my screen. The image is aligned to the left side, while the Level information section remains fixed to the right of the image. This layout meets my requirements. However, I would like the border ...

How can I delete a CSS class from an element?

Is there a way to remove the "ui-widget-content" class from the code below? It appears in multiple places throughout my code. Here is an example snippet: <pre> <form id="clientForm"> <div id="clientData"> <div id="gbox_grid_1" class=" ...

Enhance your React project by incorporating Material-UI card media elements with the ability to add

I am trying to figure out how to create an opaque colored overlay on top of an image using Material-UI. While it is possible with plain HTML, CSS, and JavaScript, I am facing some challenges with Material-UI. <Card> <CardMedia> <im ...

Is there a way to verify the presence of data returned by an API?

I am trying to implement a system in my Index.vue where I need to check if my API request returns any data from the fetchData function. Once the data is fetched, I want to return either a boolean value or something else to my Index.vue. Additionally, I wou ...

There seems to be a glitch with certain div elements not behaving as expected in Bootstrap version

I've been struggling with a persistent question lately that seems like it should have a simple solution, but I just can't seem to figure it out. The issue I'm facing is related to Chrome and how certain divs on this particular page behave ...

What is the correct xpath format for the options that are listed?

Is there a way to choose an option from the following HTML tag without using the traditional select tag? How can I generate a dynamic xpath for this particular element? <span class="select2-selection__rendered" id="select2-ContentPlaceHolder1_signup_ ...

Is it possible to incorporate a next.js image onto the background design?

I've encountered an issue while attempting to create a fixed background image with a parallax effect using Tailwind CSS and Next.js Image. If you need to see an example of this in action, check out this Template Monster theme. Here's the code s ...

How to use jQuery to extract a particular text from an anchor tag

If I want to choose a specific anchor text and make changes to it, I can do so by targeting anchors with a certain href attribute. For example, on a page with multiple unordered lists, each containing different links: <ul> <li><a href="v ...

stop the leakage of CSS and JS from the subtree to the document through the inverse shadow DOM mechanism

My page contains dynamic HTML content that I want to incorporate. The dynamic content consists of only HTML and CSS, without any JavaScript. However, I have some custom global CSS styles and JS logic that need to be implemented along with this dynamic con ...

Integrating foundation-sites with webpack, unable to apply styles

Delving into the world of webpack for the first time has been quite a daunting experience! I'm attempting to set up the foundation for sites, but I feel completely lost when it comes to configuring it properly. Here is my Webpack configuration: var ...

Using lxml to extract data from dynamic HTML elements

Struggling to extract information from a dynamic field on an HTML page using the lxml library. The code snippet I've been working with is as follows: from lxml import html import requests page = requests.get('http://www.airmilescalculator.com/d ...

The footer on my page seems to be having trouble connecting with the div section above it, causing it to abruptly halt in the middle

After spending a considerable amount of time, I managed to make my footer responsive by sticking it to the bottom of the page regardless of which page you are on. The code that achieved this is as follows: position: absolute; bottom: 0; However, the issu ...

How to locate an element in Webdriver/Selenium when it lacks a class name, id, or css selector?

Within the search results displayed in groups of 7, you can find the address and phone number for each entry on the right side as follows: I need to extract both the address and phone number for each result. The challenge lies in how these elements are st ...