473,847 Members | 1,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Lost ability to center tables vertically

I had some CSS problems, and they were solved by someone who pointed
out to me that I should have <!DOCTYPE ..... at the top of my code,
which I now do.

And it fixed all the inheritance problems, but it caused my ability to
center Tables vertically to disappear. If I remove that top line, all
is good. Except for my previous inheritance problems.

The thing is my code calls one funtion with the parameter $out_msg
which is always in Table format. It then creates the HTML output
inserting my $out_msg as a nested table.

I tried switching the template below to a DIV based structure, but am
too new to it, and turns out I was centering $out_msg on a browser port
that was above my actual browser (i cut off a good 25% of the top, even
though it showed in the HTML source).

Wow, so tired here, is there a way to proper vertically center a table
withing a table?

Thanks, and below is the code that stops cetnering if I include the top
line.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
..01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>zRetur n</title>
<LINK REL=stylesheet HREF="zstyles.c ss" TYPE="text/css">
<meta http-equiv="imagetoo lbar" content="no">
<meta http-equiv="imagetoo lbar" content="false" >
<SCRIPT TYPE="text/javascript" src=/js/javas.js></SCRIPT>
</head>
<body>
<table HEIGHT-"100%">
<tr>
<td VALIGN="MIDDLE" >
$out_msg
</td>
</tr>
</table>
</body>
</html>

Dec 27 '05 #1
11 3080
Serg wrote:
I had some CSS problems, and they were solved by someone who pointed
out to me that I should have <!DOCTYPE ..... at the top of my code,
which I now do.
If the below is exactly what you are using, it is incorrect. There is a
missing "4" in it. Copy this and don't mess with line length.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
And it fixed all the inheritance problems, but it caused my ability
to center Tables vertically to disappear. If I remove that top line,
all is good. Except for my previous inheritance problems.

The thing is my code calls one funtion with the parameter $out_msg
which is always in Table format. It then creates the HTML output
inserting my $out_msg as a nested table.
You'll have to explain how the "parameter" $out_msg becomes anything
other than a simple text string. You didn't include that in your post.
I tried switching the template below to a DIV based structure, but am
too new to it, and turns out I was centering $out_msg on a browser
port that was above my actual browser (i cut off a good 25% of the
top, even though it showed in the HTML source).
Then you were doing something wrong, probably easy to spot if you'd post
the URL.
Wow, so tired here, is there a way to proper vertically center a
table withing a table?
Nested tables are a Bad Idea™.
Thanks, and below is the code that stops cetnering if I include the
top line.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Incomplete doctype.
<html>
<head>
<title>zRetur n</title>
<LINK REL=stylesheet HREF="zstyles.c ss" TYPE="text/css">
<meta http-equiv="imagetoo lbar" content="no">
<meta http-equiv="imagetoo lbar" content="false" >
<SCRIPT TYPE="text/javascript" src=/js/javas.js></SCRIPT>
What is this script?
</head>
<body>
<table HEIGHT-"100%">
<tr>
<td VALIGN="MIDDLE" >
$out_msg
</td>
</tr>
</table>
</body>
</html>


Post the URL.

--
-bts
-Warning: I brake for lawn deer
Dec 27 '05 #2
On 27 Dec 2005 11:15:32 -0800, "Serg" <se****@aol.com > wrote:
<table HEIGHT-"100%">


Is this correct ? Shouldn't it be HEIGHT="100%" ?

-- Steven

Dec 27 '05 #3
"Steven" <No*****@Syd.au > wrote in message
news:r3******** *************** *********@4ax.c om...
On 27 Dec 2005 11:15:32 -0800, "Serg" <se****@aol.com > wrote:

Is this correct ? Shouldn't it be HEIGHT="100%" ?

yeah, it really is = ... just mistype while posting

Dec 28 '05 #4
"Beauregard T. Shagnasty" <a.*********@ex ample.invalid> wrote in message
news:ua******** *************** *******@40tude. net...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">


i'd swear this is what i have...

here is a link www.warptv.com/yucky.html
Dec 28 '05 #5
Daniel Kaplan wrote:

www.warptv.com/yucky.html


http://validator.w3.org/check?verbos...com/yucky.html

In standards mode, browsers are required to ignore invalid attributes,
among which is table height.

Every time I see this topic come up, I get visions of a scrolling
content area the size of a matchbook in the middle of the viewport. :(

Why don't you reconsider the need for vertical centering at all?

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Dec 28 '05 #6
"kchayka" <us****@c-net.us> wrote in message
news:41******** *****@individua l.net...
http://validator.w3.org/check?verbos...com/yucky.html
nice tool, thanks

In standards mode, browsers are required to ignore invalid attributes,
among which is table height.
so am i stuck between choosing: having my css inheritance work
properly...or.. .being able to center my content...or rewrite everything i
already wrote from table to div. not oneo f those are pleasant in any way
shape or form
Why don't you reconsider the need for vertical centering at all?


because it does look better if the output is centered.
Dec 28 '05 #7
Els
Daniel Kaplan wrote:
"kchayka" <us****@c-net.us> wrote in message
news:41******** *****@individua l.net...
http://validator.w3.org/check?verbos...com/yucky.html


nice tool, thanks
In standards mode, browsers are required to ignore invalid attributes,
among which is table height.


so am i stuck between choosing: having my css inheritance work
properly...or.. .being able to center my content...or rewrite everything i
already wrote from table to div. not oneo f those are pleasant in any way
shape or form


No, the fourth option will work:
Valid doctype, set html and body and table to 100% height through CSS.

Height may be invalid as an HTML attribute on a table, it works when
set as table{height:10 0%;}, but only if html and body are also set at
100%.

This will have drawbacks if you have content that's longer than the
height of the browser window though, especially if you want any
background colour or image for body.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Dec 28 '05 #8
"Daniel Kaplan" <No****@NoSpam. com> wrote in message
news:11******** *******@nntp.ac ecape.com...
so am i stuck between choosing: having my css inheritance work
properly...or.. .being able to center my content...or rewrite everything i
already wrote from table to div. not oneo f those are pleasant in any
way shape or form

I'm sorry but it truly seems to me that CSS is weak for vertical centering
within the viewport , and that tables handle that part better. It doesn't
matter if some people don't like Vert Centering, that's a choice thing.

All these different modes, and versions are driving me nuts (quirk vs.
whatever)! Could you imagine if there were as many different DVD formats as
there seem to me modes here?

ARGH!
Dec 28 '05 #9
"Els" <el*********@ti scali.nl> wrote in message
news:f0******** *******@locusme us.com...
so am i stuck between choosing: having my css inheritance work
properly...or.. .being able to center my content...or rewrite everything
i
already wrote from table to div. not oneo f those are pleasant in any
way
shape or form
No, the fourth option will work:
Valid doctype, set html and body and table to 100% height through CSS.

This will have drawbacks if you have content that's longer than the
height of the browser window though, especially if you want any
background colour or image for body.


There's my one problem, I am drawing info from a DB and posting it to the
screen. Depending on the number of entries, the length of their
description, etc, determinging the exact height of the output is a bit too
much, and not guaranteed. Scrolling is a must.

I think I have decided to give up and go back to quirks mode (which I
believe is no doc declaration at all).

I don't mean to go off on a rant here, but enough. Never actually making a
website before now, I had no idea what a mess this field is...and I'm sorry
but it is. Of course I am new to website design, old school programmer, and
I can be basing my info on incorrect info.

BUt it seems to me with DIV, I cannot create a vertically centered table,
that will scroll properly no matter what the size of my data output is...
Dec 28 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
23088
by: Tony Vasquez | last post by:
Can somoene give me an example of how to center a div, according to it's image size... I am using different images, and so I have to resize it in a functino according to the image's size. So I use a h and w vairable that give me the height and width of the current image, but I can't seem to come up with a simple freaking formula to center the image vertically and horozontally. Thanks guys. fnFullView = function () { var h var w
27
9269
by: FL | last post by:
Hi Everyone, I know howto center a block using margin-left: auto ; margin-right: auto ; but I'm trying to center vertically a box, any idea to solve this?
10
26888
by: john T | last post by:
Is there anyway to vertically center a html table using css in such a way it does not alter the html table. When I tryied it just screws up.
3
29410
by: steven | last post by:
Hi, I'm trying to center an image in a div, both horizontally and vertically. (Each div holds a thumbnail image.) Here's the HTML: <div class="thumb"> <div> <img src="tn_02-2022.jpg" /> </div> <p>
10
10368
by: Unknown User | last post by:
Yet another question about vertical centering: How can I center a page vertically? I have searched on Google and didn't find anything that works at least on IE, Opera and Mozilla: http://milov.nl/code/css/verticalcenter.html Or using a table: http://www.quirksmode.org/css/centering.html Is there a way to do it and that works in Opera, IE and Mozilla? Thanks,
2
12147
by: Eric Lindsay | last post by:
If I want to have the middle of an image vertically aligned with the middle of a heading (or several lines of heading), is there some particular way people would recommend? vertical-align: center looked made for that. The effect I want is img heading img heading img heading or heading
53
4253
by: Alan Silver | last post by:
Hello, I understand the issue that tables should be used for tabular data and not for layout, but I would like some clarification as to exactly what constitutes tabular data. For example, if I have a form, in which the user is required to fill in various bits of information, then laying out with a table makes it easy. A basic example...
1
2299
by: Rabbit | last post by:
Dear All I'm new to use ASP.Net for developement, can someone tell me how can I create a web form with size say 300px x 300px, align vertically center on the page Because so far I can use Div to align it horizontally center on the page, but I still can't find out how to do the "Vertically-center alignment"! 'cause I really want such form/table can be located center in the web page.
4
3775
by: John | last post by:
Is it possible to center a memo field value vertically? I use a memo field for printing address labels and I would like the addresses to show up centered vertically. Thanks, john
0
9734
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10995
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10718
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10347
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7061
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5730
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5915
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4132
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3171
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.