FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Howto centre an object vertical using css?





Chris Tiaens
I'm trying to centre a layer to the browserwindow, both horizontal as vertical. Horizontal isn't any problem, that's even possible with the html center tags, but vertical is more difficult. I've done it before using javascript but that's pretty complex so I wondered if there is any css statement that leads to the same effect?
JustaMin
There's:

vertical-align:middle

although only certain tags support it. Smile
Chris Tiaens
JustaMin wrote:
There's:

vertical-align:middle

although only certain tags support it. Smile


ideed, the div tags for instance don't, so it's not very helpful to me...
Reign
/* Generated by CenterFlashInxHTML.exe, available on http://www.pieterhoste.tk */


nice program to center your flash movie in xHTML, also handy when centering a div, just fill in the dimensions of your div and copy paste...

hope it helps..

EDIT: check the link "//04 OA"
Chris Tiaens
Quote:


/* Generated by CenterFlashInxHTML.exe, available on http://www.pieterhoste.tk */


nice program to center your flash movie in xHTML, also handy when centering a div, just fill in the dimensions of your div and copy paste...

hope it helps..

EDIT: check the link "//04 OA"



Thanks for the program Reign, but I can't execute it Confused. However it seems to me that it generates javascript code just like I used to do...
DX-Blog
Instead of using vertical-align you should use the workaround lineheight. Set the line-height property to be as big as the div you want to center your work in.

Vertical align uses the indent, which is created by calculating the lineheights within the box alltogether. So for a line itself this will not truly work, if you set images in your text and such it will work better I thought, still not for the text though.
Reign
Chris Tiaens wrote:
Quote:


/* Generated by CenterFlashInxHTML.exe, available on http://www.pieterhoste.tk */


nice program to center your flash movie in xHTML, also handy when centering a div, just fill in the dimensions of your div and copy paste...

hope it helps..

EDIT: check the link "//04 OA"



Thanks for the program Reign, but I can't execute it Confused. However it seems to me that it generates javascript code just like I used to do...


made in visual studio.net maybe you need the framework, sorry

this is what it does:
http://flash.reignofterror.be/etrexlegend.css
http://flash.reignofterror.be/

no javascript at all!
Chris Tiaens
I will be able to work it out manually, so the not-working program isn't a problem. Thanks Reign!
Reign
no problem at all, glad to help..
prillan
I got this thing to, thanks!
Related topics
Okay, I'm done trying to use CSS for layout.
CSS OR TABLES
CSS tooltips (sort of)
Dynamic User Customizable Sites. CSS + PHP = Awesome!
Ashens Web Design Questions Thread
Vertically centering site in window using CSS?
Rotate images using css?
How to make a picture blur or something else using CSS ?
CSS DIV layout advice
Tool to create shadow effect for an Image using CSS
[Resolved]Using css to create a link.
How change the property TARGET of tag A (LINK) using CSS?
How change the background-image of a page using CSS?
HTML to CSS code
Reply to topic    Frihost Forum Index -> Webmaster and Internet -> Design Tips

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.