Variable modal size

Struggling to achieve a fluid height modal that fills its parent container without any overflow issues. The parent object is set at 70% height and I want the content inside to span 100% of this height. Any assistance or suggestions would be greatly appreciated. Below is the code snippet along with a jsfiddle link:

http://jsfiddle.net/NS7UP/

CSS

html {
height: 100%;
min-height: 100%;
}
body {
    height: 100%;
}
.modal {
    position: fixed;
    top: 15%;
    left: 5%;
    width: 90%;
    height: 70%;
    background: #b10000;
    display: block;
    .modalWrapper {
        position: relative;
        height: 100%;
        .modalHeader {
            width: 100%;
            height: 45px;
            background: blue;
            display: block;
        }
        .modalSubheader {
            width: 100%;
            height: 25px;
            background: #007755;
            display: block;
        }
        .modalBody {
            overflow-y: scroll;
        }
        .modalFooter {
            height: 45px;
            width: 100%;
            background: cyan;
            bottom: 0;
            display: block;
            position: absolute;
        }
    }
}

HTML

<div class="modal">
<div class="modalWrapper">
    <div class="modalHeader">Turkey</div>
    <div class="modalSubheader">Chicken</div>
    <div class="modalBody">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse ci...
    <div class="modalFooter"></div>
</div>

Answer №1

Consider the following:

padding-bottom: /*Necessary %*/;

to accommodate adaptable, responsive height characteristics.

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 personalize the md breakpoint for an individual Material UI Grid component with custom CSS

I have incorporated material ui's Grid for responsive user interface design. <Grid spacing={2} xs={12} container={true}> <Grid item={true} lg={4} md={6} sm={12}>...</Grid> <Grid item={true} lg={4} md={6} sm={12}>...</Gri ...

Utilizing GSAP for crafting a dynamic horizontal scrolling section

I am currently working on creating a unique section that transforms into a horizontal scroller once the items (in this case, images) are visible, and then reverts to a vertical scroller once all the items have been scrolled through. My inspiration and ada ...

The function FormatCurrency is non-existent

I need assistance with converting a textbox value into a currency using the jquery.formatCurrency-1.4.0.js plugin. My JavaScript function is set up like this: $(document).ready(function() { $('.currency').blur(function() { $(&apo ...

Django and facial hair (relying on laravel's index)

Previously, I developed some Laravel sites using technologies like SASS, jQuery, and Angular. Now, I am attempting to utilize these sites in Django, but I have encountered errors right from the start. 2 <html lang="PL"> 3 <head> 4 &l ...

Issues with the functionality of Angular 2 routerLink

Unable to navigate from the homepage to the login page by clicking on <a routerLink="/login">Login</a>. Despite reviewing tutorials and developer guides on Angular 2 website. Current code snippet: index.html: <html> <head> ...

first item's grandchild selection

https://jsfiddle.net/jg69c3yf/1/ I don't have a lot of experience with CSS. My goal is to target the div with the class arrow-right, but only if it's inside the first child of a div with the class active. In this sample code, Only item 3 shoul ...

ASP.NET Core MVC is experiencing issues with the dropdown functionality

_Layout.cshtml: <head> <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" /> </head> <body> @if (HttpContextAccessor.HttpContext.Session.GetString("IsLoggedIn") == null) ...

Activate Bootstrap Modal with a Click of a Button

I'm interested in customizing a Bootstrap 4 modal, similar to the example on this page: https://www.w3schools.com/bootstrap4/bootstrap_modal.asp. My goal is to trigger the modal to open when clicking on specific text instead of a button. I believe us ...

Ways to showcase the coordinate values on the surface of a 3D cube using three.js

I am currently working on developing a 3D cube using three.js, which rotates and translates continuously. At the moment, I am rotating the 3D cube using randomly generated numbers, but eventually, these numbers will be sourced from an accelerometer and gyr ...

The canvas is responsive to keyboard commands, however, the image remains stationary and unaffected

As I delved into the basics, incorporating canvas, CSS, and JavaScript, a question arose: should the image be housed in the HTML or the JavaScript code? Following this, I added a background color to the canvas and defined properties of the canvas in JavaSc ...

Why is Python BeautifulSoup's findAll function not returning all the elements in the web page

I am attempting to retrieve information from the following URL . Displayed below is the code I have developed. import requests from bs4 import BeautifulSoup url_str = 'https://99airdrops.com/page/1/' page = requests.get(url_str, headers={&apo ...

Mastering the Art of Live Search in Drop Down Multi Select

I need to develop a search functionality similar to the one found on . This search should allow users to select options from a dropdown menu or type their own search query, and provide live search results. I attempted to use the jQuery plugin https://www.j ...

While using Nav, it is necessary to adjust the height of the drop-down menu to accommodate the content when the sub-menu

My dropdown menu has multiple submenus, and I'm facing an issue where the submenu content overlaps the container when opened. I want the container to scale to the height of the submenu content when opening, and then reduce back when closing the submen ...

The button must stay deactivated even if the page is refreshed

When I click on the submit button, it disables for 15 seconds before getting enabled again. However, if I refresh the page, the button becomes immediately enabled without waiting the disable time. Can someone please assist me with this issue? $(window). ...

Having trouble with the rowNode functionality in PrimeNG TreeTable

I am currently utilizing the PrimeNG Treetable component from https://www.primefaces.org/primeng/#/treetable I seem to be encountering issues with retrieving data from the service. Below is a snippet of my code: HTML <p-treeTable [value]="temp"> & ...

Exploring the effects of zooming on YouTube videos in Firefox

Strange phenomenon, but my website appears to be having display issues specifically on Firefox. Surprisingly, it looks perfectly fine on IE9, Safari, and Chrome. The layout of the site in Firefox seems to change when I zoom in or out, resulting in the You ...

Arrange information into sections

This Angular code is used to format text into profile page as blocks of data: <div class="element-box"> <div class="details-wrapper"> <p><b class="label">Remote IP</b>{{apiattempt.remote_ip}}</p> <p>< ...

Utilize a SCSS class defined in one file within a different SCSS file

In my React project, I have a day/night theme button that changes the main body color in the App.scss. It's a simple setup using body.light and body.dark. However, I need to also change the text color in the navigation bar, which is located in a diffe ...

Utilize CSS to showcase HTML text with formatted spacing for improved readability

Imagine having the following text: $scope.text = 'This is line one\nthis is line two'; and you want to display it within a div container using AngularJS <div>{{text}}</div> How can you ensure that the text is displayed with the ...

Is there a way to use PHP in place of the <form> tag in HTML in order to submit a form from a script and remain on

Currently, the code in my form looks like this: <form action="https://www.paypal.com/cgi-bin/webscr" target="_BLANK" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="paypal@ ...