English 中文(简体)
One Table and several divs position
原标题:

Have table and several div elements. Table is time grid and divs are events that may take every position relatively table from top to bottom, dependently on time.

See screenshot: alt text http://img687.imageshack.us/img687/4348/margintop.png

So to make margin-top for div correct I specify it as negative, because these divs are positioned relatively to the table.

But in some cases they positioned relatively each other and murkup is non-correct.

So how to do these divs positions to be relative to start point of screen and table to be as background, e.g. to specify “very” hegative z-index.

So, the question is how to do that table doesn’t affect position of divs.

Note: absolute position for divs is not acceptable, because while scrolling the table is scrolled and div is frozen.

Simplified example of HTML (in order) table:

<table cellspacing="0" cellpadding="0" style="margin: 0pt; padding: 0pt; width: 100%;">
</table>

div:

<div style="height: 118px; margin-left: 38px; margin-top: -94px; width: 48%;"></div>
最佳回答

You can absolutely position the div relatively.

What this involves is setting position:relative on the table, you can then set position:absolute on the contained divs, these will then scroll with table, and is a more reliable way of setting the divs location and will work better across browsers.

EDIT: Once you have set position: absolute, you want to use top: and left: not margin-top: and margin-left: as you are not using these for their purpose.

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签