Table to always leave 10px and fill popup

Posted on 2011-11-01
Last Modified: 2012-05-12
I have a bunch of edit forms that are popped up on a click event

This is an Intranet Web App

My master CSS page has a body style with a light blue background

The structure of my popup aspx pages is

             <table cellpadding="0" cellspacing="0" border="0" style="background-color:white;">

Here's my problem...

I want my popup so that no matter the popup window size (IE and Firefox)...100 x 100 or 1200 x 800....
I want my  white background table to fill 100% of the window height AND width with a 10px blue "body" margin around the table.

Also...the overflow needs to be hidden so that no scrollbars appear
Question by:lrbrister
    LVL 30

    Expert Comment

    Take a look at the jQuery UI dialog:

    I've used it plenty of times and it's incredibly easy to configure and style.

    Author Comment

    This has to be done with styles if at all possible.

    We're using Telerik RadControls and the RadWindow Manager

    When the radWindow is invoked, it pops up the aspx page with the declared (RadWindow) width and height.

    I need the aspx page itself to have the formatting applied that I requested in my post.

    LVL 42

    Accepted Solution

    Try this. (You don't need those attributes on the <table>.)
    /* these styles won't fully work in IE versions before 8 */
    html, body, form, form>div:first-child, form>div>table {
      height: 100%;
      margin: 0;
      padding: 0;
    body {
      padding: 10px;
      background: blue;
    form>div>table {
      background: #fff;
      width: 100%;
      border: 0 none;
      border-spacing: 0;
      border-collapse: collapse;
    form>div>table th,
    form>div>table td {
      padding: 0;

    Open in new window

    > Also...the overflow needs to be hidden so that no scrollbars appear

    Are you sure you want to do that? What happens when someone increases the font-size, zooms the page, or resizes the browser window?
    LVL 18

    Expert Comment

    The first question is how are you creating and calling the popup window?  Are you creating a lightbox or an actual new browser windows?

    If using a simple JavaScript call to create a new window, controling size and scrollbars is easy;

    <script type="text/javascript">
    function open_win()
    {"popup.asp","_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=100, height=100");

    Call it like this;

    <input type="button" value="Open Window" onclick="open_win()">

    After you call the popup page, use standard CSS properties to create a white page with a blue margin;

          <style type="text/css">
    body {
          background-color: #0000cd;
          margin: 10px 10px 10px 10px;
    table {
          background-color: white;

    <table cellspacing="0" cellpadding="0" border="0" width="100%" height="100%">
          <td>test popup</td>
    LVL 18

    Expert Comment

    Or perhaps you are looking for a better looking example that doesn't use a browser window at all, only jQuery.  I have used ColorBox, ( before for what you are doing, it will load an external page, or you can embed the code into a <div> tag and call it internally.

    Author Closing Comment

    Thanks...will do that with ID and # leader

    Featured Post

    Training Course: Android App Development

    This course will involve creating widgets, customize list view, grid view, spinners, etc. Creating applications using audio, video, and SQLite database. Ending with publication on Google Play.

    Join & Write a Comment

    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
    In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
    In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at Browse or search based on font properties or name to find a suitable font for…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now