Simple HTML question Vertical middle of a page?
#1
Posted 28 March 2009 - 06:44 PM
How do I achieve to display text in the vertical middle of the page?
(It is easy to do it horizontally with align="center", but to do it vertically probably need a bit of trick.)
#3
Posted 28 March 2009 - 09:09 PM
groovicus, on Mar 29 2009, 01:55 AM, said:
Right off the top of my head......
Thanks, I tested it. It does not seem to work. This is what I did:
<body style="margin-top:50%; margin-bottom:50%;"> <center> hello </center> </body>
And it gave me a long vertical slide bar, and the text was off the screen, I had to scroll down. Check that out.
#4
Posted 28 March 2009 - 09:16 PM
<body> <table width=100% height=100%> <tr><td> <center> hello </center> </td></tr> </table> </body>
Strange enough it gives text to the middle of the page. It seems that <center> works both vertically and horizontally.
#5
Posted 29 March 2009 - 09:49 AM
b. <center> is deprecated, which means that it should not be used at all. There may come a point in time where browsers quit supporting it, and your page will break.
c. center has nothing to do with vertical alignment.
#6
Posted 29 March 2009 - 02:31 PM
groovicus, on Mar 29 2009, 04:49 PM, said:
b. <center> is deprecated, which means that it should not be used at all. There may come a point in time where browsers quit supporting it, and your page will break.
c. center has nothing to do with vertical alignment.
Yes I noticed. I cant put an embedded object or a picture to the center of page, what ever I do, what ever I try.
All I want is to put e.g. a picture to the center of a page (vertically and horizontally).
I guess the solution would be to create some table %100 x %100 and align it vertically, but nothing works for me
:-(
#7
Posted 29 March 2009 - 11:22 PM
#8
Posted 30 March 2009 - 09:44 PM
burn1337, on Mar 30 2009, 06:22 AM, said:
Ok I will try that. This sounds good. No idea what is CSS2, but I sow the <div> tags somewhere. I will also try the valign parameter. Was align depreciated as well? I use align in 100% of my scripts.
The margin-bottom and margin-top did not for for me. I.e. the picture has 20% of the website side, and I put margin-top and margin-bottom at 50%--- I am left with a page of 120% size and ugly side bars.
Thank you all for the great suggestions. Keep me posted.
#9
Posted 30 March 2009 - 10:21 PM
#10
Posted 30 March 2009 - 10:56 PM
burn1337, on Mar 31 2009, 05:21 AM, said:
a. But if I position it with CSS all my readers using IE will will not see it in the middle? That is a big price.
b. I could live it putting it down with at least 25% margins.. not perfect but better then <br><br><br>
c. What do you use if not align? How anything be done without align="center"?
#11
Posted 30 March 2009 - 11:15 PM
Quote
Yeah, well this statement is incorrect:
Quote
CSS2 has been a standard since 1998, and just underwent a minor revision last year. Perhaps he meant CSS3?
Quote
You use CSS styles.
http://www.quackit.com/css/css_align.cfm
http://www.ehow.com/how_2284643_left-right...-align-css.html
Incidentally, if you have a question about which tags are deprecated, or how to use the tags, use a search like this:inurl: w3c.org align. Replace 'align' with any tag that you are questioning. The text will tell you exactly which browsers trip over which tags, or which tags are deprecated, etc.
#12
Posted 31 March 2009 - 01:08 PM
Patbox - You can have the image as a background image, the css for changing the position of a background image is supported with Internet Explorer.
#13
Posted 31 March 2009 - 09:31 PM
burn1337, on Mar 31 2009, 08:08 PM, said:
The image was an example, in fact I want to put embedded objects to the middle of page (like videos). I am really shocked how many differences there are between FF and IE (probably also OPera does its own stuff).
#14
Posted 31 March 2009 - 09:45 PM
Quote
Quote
The problem that you are trying to solve is that you want different types of objects to behave in the same way, and that isn't going to happen. The best you can do is center an IFrame or a Div, and then feed the content into that container.
#15
Posted 31 March 2009 - 10:31 PM
Patbox - Ok so you want an image in the center of the page, but you also want objects in the center of the page... So are you wanting the objects to overlay the picture, or are you wanting the picture to overlay the objects? btw with the method I said, you don't have to have it as the background of all your pages, I meant in the div you want to display it, set it as it's background pic, and use the background alignment capabilities...

Help



Back to top









