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:
fluffy_lobster
Veteran Member
*****

Avatar
Posts: -2

Posts: 1391
Reputation: 23
36 / Male / Flag
Joined: Nov 2002
RE: Center an object in HTML while having it at location '0' from the top...
quote:
Originally posted by lhunath
quote:
Originally posted by fluffy_lobster
<body topmargin="0"><table align="center">...
Ewww!
God's sake.

HTML:
<iframe id="myframewhichiwantcentered" ....></iframe>
CSS:
#myframewhichiwantcentered {
position: absolute;
top: 0px;
width: [framewidth]px;
left: 50%;
margin-left: -[framewidth]px;
}

Don't do it in CSS, then don't do it at all, or perlease keep it XHTML compliant...
or if you can't be bothered to keep the CSS somewhere seperate; do it the lame way:

<iframe style="position: absolute; top: 0px; left: 50%; width: [framewidth]px; margin-left: -[framewidth]px;" .....></iframe>

Btw, Iframes are ghay =)

~lhun
You're right - I wasn't aware the topmargin attribute was no longer valid.  However blade was asking for an HTML solution, so I hardly see preaching that mess of a css hack a tidy alternative.  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;">

For the horizontal centering, either raceprouk's align: center; style or the html attribute align="center" are valid and intercompatible.

By the way, racepro, the vertical-align: top; is obsolete because that's the default for members of the <body> element. The issue with top aligning it was that there is a default top margin of something like 10px
09-11-2004 11:21 AM
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