What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Center an object in HTML while having it at location '0' from the top...

Center an object in HTML while having it at location '0' from the top...
Author: Message:
lhunath
Full Member
***

Avatar
.{ Lord Daisy }.

Posts: 343
40 / Male / –
Joined: May 2004
RE: Center an object in HTML while having it at location '0' from the top...
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>


This post was edited on 09-11-2004 at 01:45 PM by lhunath.
{ -[Image: lhunath.gif]- }
09-11-2004 01:36 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Center an object in HTML while having it at location '0' from the top... - by .blade// on 09-10-2004 at 04:34 PM
RE: Center an object in HTML while having it at location '0' from the top... - by fluffy_lobster on 09-10-2004 at 06:53 PM
RE: Center an object in HTML while having it at location '0' from the top... - by .blade// on 09-10-2004 at 06:59 PM
RE: Center an object in HTML while having it at location '0' from the top... - by fluffy_lobster on 09-10-2004 at 07:07 PM
RE: Center an object in HTML while having it at location '0' from the top... - by .blade// on 09-10-2004 at 07:21 PM
RE: Center an object in HTML while having it at location '0' from the top... - by lhunath on 09-10-2004 at 09:46 PM
RE: Center an object in HTML while having it at location '0' from the top... - by .blade// on 09-10-2004 at 09:55 PM
RE: Center an object in HTML while having it at location '0' from the top... - by k776 on 09-10-2004 at 10:06 PM
RE: Center an object in HTML while having it at location '0' from the top... - by RaceProUK on 09-10-2004 at 10:31 PM
RE: Center an object in HTML while having it at location '0' from the top... - by fluffy_lobster on 09-11-2004 at 11:21 AM
RE: Center an object in HTML while having it at location '0' from the top... - by Banks on 09-11-2004 at 12:34 PM
RE: Center an object in HTML while having it at location '0' from the top... - by lhunath on 09-11-2004 at 01:36 PM
RE: Center an object in HTML while having it at location '0' from the top... - by RaceProUK on 09-11-2004 at 02:51 PM
RE: Center an object in HTML while having it at location '0' from the top... - by lhunath on 09-12-2004 at 09:33 AM
RE: Center an object in HTML while having it at location '0' from the top... - by RaceProUK on 09-12-2004 at 10:40 AM
RE: Center an object in HTML while having it at location '0' from the top... - by lhunath on 09-12-2004 at 10:58 AM
RE: Center an object in HTML while having it at location '0' from the top... - by RaceProUK on 09-12-2004 at 11:03 AM
RE: Center an object in HTML while having it at location '0' from the top... - by BART SIMPSON416 on 09-12-2004 at 11:42 AM
RE: Center an object in HTML while having it at location '0' from the top... - by lhunath on 09-12-2004 at 12:02 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On