quote:
Originally posted by raceprouk
The easiest way is to use CSS, and use
code:
vertical-align : top;
align : center;
1. Vertical align isn't even supported in many many browsers, such as, Internet Explorer.
2. Align: center won't work on iframes, but it would on a table containing an Iframe, since what it does is align the
content of an object, rather than the object itself.
quote:
Originally posted by fluffy_lobster
All that actually needs to be done is give the body the margin-top: 0px; style, and seeing as it's a lone attribute there's no real reason why not to use inside the tag; <body style="margin-top: 0px;">
Yes, very true, but what I posted is a way of making sure the page remains as dynamic as possible, since I'm using position: absolute. That way, no other content will disturb the flow. Frankly, yes, for his case I assume this sollution would be better (in the case that the object he wants centered itself doesn't have a standard margin/padding - like I assumed as well).
quote:
Originally posted by Banks
code:
margin-left: auto;
margin-right:auto;
Yes! exactly. I use "margin: auto;" though, short-hand. Yet it won't work on absolute positioned objects, like my example, since the auto margin, autos to 0 in that case.
quote:
Originally posted by lhunath
<iframe style="position: absolute; top: 0px; left: 50%; width: [framewidth]px; margin-left: -[framewidth]px;" .....></iframe>
Let me correct myself:
<iframe style="position: absolute; top: 0px; left: 50%; width: [framewidth]px; margin-left: -[framewidth / 2]px;" .....></iframe>
Or like suggested above:
code:
<body style="margin: 0; padding: 0">
<iframe style="margin: auto;" .... ></iframe>
<Iamhtml></Iamhtml>
</body>