lcjury
lcjury

Reputation: 1258

How to make a div to not ocuppy space?

I have the following.

enter image description here

If u see, the "asdasdasd" text is not near the top of the div. I have a div with two divs inside

<div id="widget">
<div id="header"> </div> 
<div id="content"> </div>
</div>

The header div have a fixed height, and this background image.

enter image description here

If you see what is in red, that part of the background make me need the div to be bigger, but it moves the content div down.

I tried to pull it up using margin-bottom: -Ypx; but I think its a ugly fix. I can't find something that works for me.

somebody can help (:?

Upvotes: 0

Views: 56

Answers (1)

DaniP
DaniP

Reputation: 38252

Yeah you can use the position:absolute to keep out the div header you need this properties:

#widget {
  position:relative;
}

Make the parent relative, that way the position absolute of the header will be relative to this container

#header {
  position:absolute;
  top:0;
  left:0;
}

Position absolute to the top ande left of his container

Upvotes: 2

Related Questions