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

  • Home
  • SEARCH
  • 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 8341935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:37:42+00:00 2026-06-09T05:37:42+00:00

How to get an empty (in example white) area in a container with Javascript?

  • 0

How to get an empty (in example white) area in a container with Javascript?
Is there a ready jQuery function or something equal?

screen

I need the width, height, left and top position of the ’empty’ white area in Javascript.

http://jsfiddle.net/P4QHj/

HTML

<div id="container">
  <div class="box-item a">A</div>
  <div class="box-item d">D</div>
  <div class="box-item e">E</div>
  <div class="box-item f">F</div>
</div>​

CSS

.box-item {
 width: 100px;
 height: 100px;
 background-color: grey;
 display:block;
 position:absolute;
}

#container {
 position:relative;
 width:300px;
 height:300px;
 min-width:300px;
 max-width:300px;
}

.a {
 position:relative;
 left:100px;
 width:200px;
 height:200px;
}

.d {
 left:0px;
 top: 200px;    
}
.e {
 left:100px;
 top: 200px;    
}
.f {
 left:200px;
 top: 200px;    
}

​

TIA
frgtv10

  • 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-09T05:37:45+00:00Added an answer on June 9, 2026 at 5:37 am

    In your case it’s easy: You know the layout, take the left value of “A” and the top value of the other elements – 100 x 200px.

    For a more general solution with unknown space and unknown elements positions, you can only apply a grid/table on the container.

    1. get dimensions of your #container
    2. choose a grid spacing (in your case: 100px, to get all space in unknown layouts use 1px)
    3. Build a two-dimensional array of the size “dimension” / “grid interval” (here: 3x3) of boolean values or zeros
    4. loop over all box-items
      1. get position and dimension of the box
      2. divide through grid interval
      3. increase the coverage count (or set to true) of the respective values in the array
    5. The spaces still have 0/false value in the grid. Multiply their indizes with the grid spacing to get the coordinates.

    For getting dimensions, jQuery’s width/height functions can be of help. For the positions, you will need to read the top/left style values. They would be much easier to get when written as inline styles, not with ids (or even once-used classes) in a style sheet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get patch file for inital commit (which is not empty) for
$(function() { setInterval(function() { $.get(refresh.php, function(result) { $('#response').empty() .hide() .html(result) $(#response).append(result) .fadeIn(slow); }); },
I am using below code to get a page: $.get('http://example.com/page1.html', function (data) { });
While generating an XML content, I get an empty node <node/> , and I
Whenever the tags argument is not empty I get a NotSupportedException: Local sequence cannot
$new = $this->memcache->get(posts); if(empty($new)){ // Get the new posts $new = Posts::getNow(10); // Save
I get the error Data Source cannot be empty. Use :memory: to open an
If I pass an empty list into a JPA query, I get an error.
If I don't include the stdafx even in an empty .cpp, I get this
Iam trying to follow the multithreading example given in: Python urllib2.urlopen() is slow, need

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.