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 9164587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:43:10+00:00 2026-06-17T14:43:10+00:00

How would I vertically center a modal window, but also keep a 20px distance

  • 0

How would I vertically center a modal window, but also keep a 20px distance from the edges at Top & Bottom?

Here is what I have currently:

#colorbox, #cboxWrapper{position:absolute; top:20px; bottom:20px; left:0; z-index:9499;}

It creates a 20px margin on top, but none on bottom. Why is that?

Thanks!

  • 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-17T14:43:11+00:00Added an answer on June 17, 2026 at 2:43 pm

    The Fiddle : http://jsfiddle.net/BZKHq/1/

    The HTML:

    <p>Lorem or whatever makes your ipsum dolorful Lorem or whatever makes your ipsum dolorful Lorem or whatever makes your ipsum dolorful Lorem or whatever makes your ipsum dolorful Lorem or whatever makes your ipsum</p>
    
    <div id="overlay">Lorem ipsum and stuff...</div>
    

    The CSS

    #overlay {
        color:white;
        background-color: black;
        position:absolute;    /* <<<--- The trick starts here ---<<< */
        bottom:0;
        top:0;
        left:0;
        right:0;
        margin:20px;    /* <<<--- The trick ends here ---<<< */
        padding:20px;
        z-index: 10000;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought line-height would vertically center align text. But this is not happening for
How would you do this: http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page Except with a fluid center (vertically stretched, height
I would like to resize a Java BufferedImage, making it smaller vertically but without
I would like to vertically center the image I am adding via the CSS
I have the following and want to vertically center-align the image. How would I
I would like to align my container div to center vertically just like it
I would like to vertically center my main content div. I am open to
I'm trying to center text within a DIV, not just horizontally but vertically too
I would like to vertically center the image in the below HTML, so that
I've got a dock of icons that I would like vertically centered. This of

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.