Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9125023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:42:17+00:00 2026-06-17T06:42:17+00:00

I have a custom sized (80% height width) bootstrap modal body and it scrolls

  • 0

I have a custom sized (80% height width) bootstrap modal body and it scrolls (body content will overflow on some sized screens)

There are 2 problems:

  1. I can’t set the max-height to 100% as that will be 100% of the entire document instead of the max height of the container, which is what i need for scrolling to work properly.
  2. If there is a div with a fixed height inside the modal body at the very end, it will overflow outside of the modal if the screen is not big enough for the content.

How would I fix this? I’m currently experimenting with negative margins but i’m not too familiar with it.

JavaScript solutions are acceptable (jQuery is available as is backbone.js)

Thanks

Edit: Screenshot provided

enter image description here

Edit 2: More screenshot

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:42:18+00:00Added an answer on June 17, 2026 at 6:42 am

    I caved in and wrote coffeescript to fix this. If anyone’s interested, here’s the coffeescript:

    fit_modal_body = (modal) ->
      header = $(".modal-header", modal)
      body = $(".modal-body", modal)
    
      modalheight = parseInt(modal.css("height"))
      headerheight = parseInt(header.css("height")) + parseInt(header.css("padding-top")) + parseInt(header.css("padding-bottom"))
      bodypaddings = parseInt(body.css("padding-top")) + parseInt(body.css("padding-bottom"))
    
      height = modalheight - headerheight - bodypaddings - 5 # fudge factor
    
      body.css("max-height", "#{height}px")
    
    # Here you need to bind your event with the appropriate modal, as an example:
    $(window).resize(() -> fit_modal_body($(".modal")))
    

    Or the equivalent javascript as generated per above.

    var fit_modal_body;
    
    fit_modal_body = function(modal) {
      var body, bodypaddings, header, headerheight, height, modalheight;
      header = $(".modal-header", modal);
      body = $(".modal-body", modal);
      modalheight = parseInt(modal.css("height"));
      headerheight = parseInt(header.css("height")) + parseInt(header.css("padding-top")) + parseInt(header.css("padding-bottom"));
      bodypaddings = parseInt(body.css("padding-top")) + parseInt(body.css("padding-bottom"));
      height = modalheight - headerheight - bodypaddings - 5;
      return body.css("max-height", "" + height + "px");
    };
    
    $(window).resize(function() {
      return fit_modal_body($(".modal"));
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom UITableView cell that has a UIImageView sized to the width
I have created the following subclass to do some custom drawing: // DocumentIconView.h @interface
Here there, I have a custom UIView. This view acts as a activity indicator
If I have a custom class subclassing Sprite and it draws some simple objects,
Hi I have a simple application where I have a some custom views and
I have a custom control of class DottedCanvas inherited from Canvas, which contains some
I have a variable sized UIView with a drawRect containing CoreGraphics custom drawing code.
I have a custom UIView with some buttons as subviews. I am using touchesBegan/Moved/Ended
I have a custom made UINavigationBar (different size, background etc) that has inside a
I have a custom UIImageView which inserts a sublayer like this: - (id)initWithFrame:(CGRect)frame {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.