"Stylish CSS Modal with Custom Header and Dynamically Generated Content

I am currently developing an HTML/CSS dialog window that consists of a header and scrollable body. My goal is to have the body adjust in size according to its content, but display scrollbars within the body if the dialog extends beyond the browser window. Unfortunately, I am experiencing difficulty in making the body scrollable. Can anyone provide guidance on how to rectify this issue? Here is the code snippet that I am utilizing (accessible via jsFiddle: http://jsfiddle.net/4Xvfm/1/):

<div class="dialog">
    <div class="header">Header</div>
    <div class="content">
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Pariatur, error, sunt, quaerat aliquid voluptatem dolorum in amet facere dolores cumque magnam placeat! Numquam, nisi, possimus facere iure eos minus repellat.
    </div>
</div>

Below are the CSS styles being utilized:

.dialog {
    background-color: red;
    max-width: 100%;
    width: 400px;
    max-height: 100%;

    /* Positioning the dialog at the center of the screen */
    position: absolute;
    left: 50%;
    top: 50%;
    -webkit-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
}

.dialog > .header,
.dialog > .footer {
    background-color: blue;
    height: 50px;
}

.dialog > .content {
    /* The scrolling functionality is not functioning as expected */
    overflow: auto;
}

Answer №1

Modify the overflow value to scroll by using "overflow:scroll"

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

Exploring the World of GiantBomb APIs

I have successfully created an account and obtained my API key. I am looking to implement a basic search functionality on my webpage, where users can enter a search query and click a button to display the game title and image. You can find more informatio ...

Issues with Flexbox functionality in Aurelia app using the webpack starter kit

When using basic HTML with flexbox, it is possible to create a layout with a header, footer, and content area that fills the space in between: <html> <body style="display:flex;flex-direction:column;flex-grow:1"> <div style="display ...

Trouble filling a List<WebElement> from a Table using Selenium Java

I am experiencing difficulty filling a List from a table: <div class="es"> <button class="btn btn-primary" [routerLink]="['add']">New User</button> </div> <div class="User_table" id="t02" > <div class="table ...

Styling a webpage with a two-row layout using just CSS

I am looking to design a 2-row layout for a webpage where one row will contain filters and the other row will display results. The layout should meet the following criteria: The page height should not exceed 100% The first row's height will vary bas ...

What are some methods for creating full-page background images?

I attempted to apply a background image to the body element using the following CSS code: body { background: url("http://beerhold.it/1024/800") center bottom; z-index: 10; height: 100%; background-repeat: no-repeat; ...

How to enable automatic video playback using the <iframe> element?

I am having trouble getting the videos in MediaCore to autoplay unlike YouTube videos by using '?autoplay=1' with the iframe tag. Is there a way to make the videos in MediaCore autoplay as well? ...

Preventing automatic image adjustment in CSS during zooming in or out

<div class="footer"> <img class="fisk" src="fisk1.jpg" alt="fisk"> </div> I am facing an issue with keeping the size of an image constant when zooming in and out. Despite trying various methods, I have not been successful in achieving ...

Issue with Bootstrap carousel - the carousel.on method is not recognized

I have implemented a standard Bootstrap carousel in my project: <div id="myCarousel" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <li data-target="#myCarousel" data-slide-to="0" class="active"> ...

The timeline aesthetic can be achieved solely through the use of HTML, CSS, and potentially some Bootstrap functionalities

https://i.sstatic.net/EsDAE.png Up to this point, I've only been able to make it this far. I'm using a sample code from w3school https://i.sstatic.net/G1FcQ.png I've been attempting to get the year in the same position as in the image, bu ...

Unable to click on overlay in Internet Explorer version 8

When I click my overlay in different browsers like Firefox, Chrome, and IE9, the onClick function is triggered as expected. However, in IE8, it seems like the box is not clickable at all and the content behind it is receiving the click events instead. Here ...

Get rid of the blue outline border when embedding Google Maps

Does anyone know how to remove the blue focus border that appears when clicking on an embedded Google Map? I've tried various CSS styles without success: *:focus { outline: none !important; border: none !important; } iframe { outline: no ...

Use a forEach loop to transfer the content of one tag to another tag

EDIT: I'm confused as to why this was labeled as a duplicate when the previous question did not address my specific issue. Yes, it involves using querySelector, but how can I achieve this using forEach? Please help me revise this. I am attempting to ...

Can Angular Flex support multiple sticky columns at once?

I am trying to make the information columns in my angular material table stay sticky on the left side. I have attempted to use the "sticky" tag on each column, but it did not work as expected. <table mat-table [dataSource]="dataSource" matSort class= ...

The translation feature in React does not seem to be functioning properly with SASS

After trying various display settings like flex and block without success, I realized that the transform property was not working as expected. Despite centering elements successfully using other methods, the transform doesn't seem to have any effect o ...

Displaying text over an image while hovering

Is there a way to display text over an image when hovered, without affecting the current text box effects? I need some assistance with this. * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; ...

Encountering a server error when trying to retrieve images through an AJAX call

When trying to make an Ajax GET request to fetch an image from another view in MVC ASP.NET, I encounter an error where the function does not hit the success method. The console shows the following error message: "GET http://localhost:1879/cardimages/getima ...

My code seems to be malfunctioning - why can't I keep the aspect ratio?

UPDATE: Can someone please assist me with maintaining the aspect ratio of a drawn image? I am struggling to achieve this and would appreciate any help. I have been attempting to upload an image, draw it using the imageDraw() function, and fit it within a ...

What are the steps to applying strike-through text in Vue.js?

I am currently working on a to-do application using Vue.js and I want to implement a feature where the text rendered in HTML has a line through it when the user checks an item off the list. Here is the snippet of my code: <html> <head> & ...

Exploring the content of a website using Chrome's inspect element feature

My goal is to create a script that can extract data from the source code of a webpage. The source code of the webpage seems to be protected, making it challenging to access. However, by using Chrome's inspect element feature, I am able to copy the bo ...

Multi selection dropdown feature in Angular failing to populate the options

I am working on a small Angular controller that manages a dropdown menu, with the second dropdown menu populating based on the selection made in the first one. Despite my best efforts, I can't seem to populate the dropdown menus with any content from ...