|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
problems with the height of div element
Hallo,
I want to place a div-element in my page. This element holds other div's (with table’s, images ...). Placing the different elements is no problem but the "dynamic" height based on different amount of content gives me a problem. Anyone with a suggestion? this is my style def.: #main { position:absolute; left:50%; top:10px; width:760px; height:100%; margin-left:-380px; border: 1px solid #3300FF; } |
|
#2
|
||||
|
||||
|
Quote:
what happens if you just don't have a height attribute? -Greg
__________________
new jersey web design |
|
#3
|
||||
|
||||
|
Hallo,
Sorry that i answer so late... (forgot to subscribe to this thread) I fixed my problem allready with a relative postion: check www.finalwebsites.com But i have another problem with centering in both directions. Is it possible to do this without absolute postion? |
|
#4
|
||||
|
||||
|
See my vertical centering demo. Vertical centering is problematic in CSS. This hybrid method seems a reasonable solution.
cheers, gary
__________________
There are those who manage to build a web site without knowing what they're doing; thereby proving to themselves they do, indeed, know what they're doing. My html and css workshop, demos and tutorials. Ask a better question, get a better answer. |
|
#5
|
||||
|
||||
|
But you use a table...
Is there someone with a tableless solution? |
|
#6
|
||||
|
||||
|
Quote:
Code:
top: 50%; margin-top: -xxpx /*where xx is ½ the element height*/ gary |
|
#7
|
||||
|
||||
|
OK, but will this work with "position:relative" ?
|
|
#8
|
||||
|
||||
|
Quote:
gary |
|
#9
|
||||
|
||||
|
Hallo,
I think you suggest not the same what i want to resolve... Check www.berg-trampoline.com This page is centered but the absolute positioned layer are partely hidden on smaller screens. |
|
#10
|
||||
|
||||
|
Code:
position:absolute; left:50%; top:50%; width:800px; height:600px; margin:-300px 0 0 -400px; border: 1px solid #009966; } cheers, gary |
|
#11
|
||||
|
||||
|
That's funny this layout is based on the export of macromedia flash.
What's is better method? |
|
#12
|
||||
|
||||
|
Quote:
The method used in my demo. For horizontal centering alone, see my horizontal centering demo. It even includes a hack for IE in quirks mode. In a nutshell, Code:
margin: 0 auto; gary |
|
#13
|
||||
|
||||
|
Yes, i do it the same on other pages but i want to center vertical and horizontal (without tables)
|
|
#14
|
||||
|
||||
|
Good luck. Right now, there is no CSS way to center vertically in the general case. How many ways must you be told?
gary |
|
#15
|
|
|
|