Aleksandr Ivanov
Aleksandr Ivanov

Reputation: 2786

A problem with div positioning

A have something like that: alt text http://img718.imageshack.us/img718/9625/88827634.png

It's OK but i want to add some Title block at the top of Content.

So it can be look like that: alt text http://img824.imageshack.us/img824/9541/31597153.png

I don't know what Title height will be, because there will be some dynamic content.

How to solve this problem?

Upvotes: 0

Views: 373

Answers (1)

rob waminal
rob waminal

Reputation: 18429

why are you positioning all your divs in absolute?

anyways you can wrap Title and Content with 2 divs, the outer div must be in absolute and the inner div is a relative, and you can put an absolute positioning in your Title and Content

<div style="position:absolute">
  <div style="position:relative">
      <div style="position:absolute">Title</div>
      <div style="position:absolute">Content</div>
  </div>
</div>

Figure out the Top and Left of Title and Content, since it will not go outside the green and blue colors of your drawing..

I position absolute the outermost div since you are positioning all your divs in absolute. I assume you already have the measurements for all just like in your first drawing.

Upvotes: 1

Related Questions