Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Align an object "center" but not only left or right but top and down ?

Status
Not open for further replies.

FlatHead

Programmer
Oct 13, 2000
50
GB
Is it possible without framing a page to align an object for example a flash movie within an HTML page excactly in the center of the screen?????

In other words say we have a small flash movie or an image.
Small in size i mean (eg. 640x420)

All i want to do is to center the movie in the center of the screen (left-right center as well as top-bottom center) without using frames if it is possible.
This will help me to have the same exactly appereance of the screen in different screen platforms.
I know this is doable using frames but then is more complicated if the site is not a flash movie. Also i know the (aligh = "center") but as im concerned this works only for left or right alignment.

Is there anyone who can help.
 
use css (style sheets)
(whole specs on the w3c site, links to tutorials ... on the w3c site)
 
oh yes, you can also use a table to do so
and valign=middle and align=center
 
This works EXCELLENT on IE (85% of your audience):

Code:
<table border=&quot;0&quot; width=&quot;100%&quot; height=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
  <tr>
    <td width=&quot;100%&quot; valign=&quot;middle&quot; align=&quot;center&quot;>
      <table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
        <tr>
          <td width=&quot;100%&quot;>CENTER ME</td>
        </tr>
      </table>
    </td>
  </tr>
</table>

The main table is 100% wide and 100% high with align center and vertical align middle. We do this with our login screens and I think it looks real cool, check it out!

» » » » » »
Mike Barone
FREE and Pro CGI/Perl Scripts

FREE Scripts
 
Thanks a lot for your instant responses iza and MikeBarone.
im going home to play now with your tips provided.
Regards
h@rrI$

 
&quot;valign=middle and align=center&quot; is close but it is missing the height and width of 100%. The 'center' will definately get the width centered but without the 100% height added to the table there is nothing that is centering the entity vertically.

I was not disagreeing with you, just adding to your post with the actual code and an example being used in the real world. » » » » » »
Mike Barone
FREE and Pro CGI/Perl Scripts

FREE Scripts
 
sorry, i'm still in the same &quot;one of those days&quot; day ;-)
well, in less than 1 hour i'll be leaving - going back home and get ready for tomorrow NOT to be &quot;one of those days&quot; !!!
 
Hello iza and MikeBarone
I would like to thank both of you for your helpfull tip!!!!
The nice part ofthe tip is that working in both browsers:))))))))))))))))))))))))))))))))))))))))))))

This is what i wanted guys!!!!!!!!

you can check this site to see why i was worrying:)


Regards
h@rrI$
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top