🔒 Locked
html puzzle.
Advertisement
Original Post
I've never done this in HTML, I don't even know if it will conform to HTML 4.01 Transitional. I'm trying to make half of the window black and the other half of it white, a vertical split. It's pretty tricky. I've tried a centered background but it didn't work on all browsers. Any ideas?
<table width=100%><tr><td bgcolor="black" width="50%"> </td><td bgcolor="white" width="50%"> </td></tr></table>You will need to write some javascript to make this table the same height as the page, or you can do it the cheap way and add a bunch of <BR>'s or a tall transparent image.
That's my problem, I can't use this method because the vertical split is used as a background for a centered table.
Quote:
Original post by Chris81
You will need to write some javascript to make this table the same height as the page...<!--QUOTE--></td></tr></table></BLOCKQUOTE><!--/QUOTE--><!--ENDQUOTE-->...or just set <tt>height="100%"</tt> next to the width.<br></td></tr></table></blockquote>
Hmmm, it's going to be like this.
|------|------|
| wwww | bbbb |
| wwww | bbbb |
| wwww | bbbb |
| wwww | bbbb |
| wwww | bbbb |
|------|------|
and then centered on top of it is.
|-------|
| wwbbb |
| wwwbb |
| wwbbb |
| wwwbb |
| wwbbb |
|-------|
That's a good idea, I never thought of that one ...
|------|------|
| wwww | bbbb |
| wwww | bbbb |
| wwww | bbbb |
| wwww | bbbb |
| wwww | bbbb |
|------|------|
and then centered on top of it is.
|-------|
| wwbbb |
| wwwbb |
| wwbbb |
| wwwbb |
| wwbbb |
|-------|
Quote:
Original post by Chris81 Quote:
Original post by PumpkinPieman
That's my problem, I can't use this method because the vertical split is used as a background for a centered table.
Then use a black/white gif and use CSS to set it to stretch instead of tile.
That's a good idea, I never thought of that one ...
Quote:
Original post by benryves Quote:
Original post by Chris81
You will need to write some javascript to make this table the same height as the page...<!--QUOTE--></td></tr></table></BLOCKQUOTE><!--/QUOTE--><!--ENDQUOTE-->...or just set <tt>height="100%"</tt> next to the width.<!--QUOTE--></td></tr></table></BLOCKQUOTE><!--/QUOTE--><!--ENDQUOTE--><br><br>That's never worked for me in IE.</td></tr></table></blockquote></td></tr></table></blockquote>
Quote:
Original post by Chris81
Then use a black/white gif and use CSS to set it to stretch instead of tile.
Does CSS even have a stretch member? I can't seem to find anything.
Quote:
Original post by Chris81 Quote:
Original post by benryves Quote:
Original post by Chris81
You will need to write some javascript to make this table the same height as the page...<!--QUOTE--></td></tr></table></BLOCKQUOTE><!--/QUOTE--><!--ENDQUOTE-->...or just set <tt>height="100%"</tt> next to the width.<!--QUOTE--></td></tr></table></BLOCKQUOTE><!--/QUOTE--><!--ENDQUOTE--><br><br>That's never worked for me in IE.<!--QUOTE--></td></tr></table></BLOCKQUOTE><!--/QUOTE--><!--ENDQUOTE-->You have a broken copy of IE, in that case. [smile]</td></tr></table></blockquote></td></tr></table></blockquote></td></tr></table></blockquote>
If I understand correctly, I had the same problem not that long ago.
If you look here, you see a gradient background. It's pretty much composed in the same way: half the screen has one shade of gray, the other half has a darker shade of gray, and I centered a "layer" with the gradient background image on top of that. This way I'm certain it will show correctly, no matter what screen resolution.
I've extracted a lighter version here, to show the basic idea (blue and red instead of black and white). Just see if you can use it.
If you look here, you see a gradient background. It's pretty much composed in the same way: half the screen has one shade of gray, the other half has a darker shade of gray, and I centered a "layer" with the gradient background image on top of that. This way I'm certain it will show correctly, no matter what screen resolution.
I've extracted a lighter version here, to show the basic idea (blue and red instead of black and white). Just see if you can use it.
Quote:
Original post by benryves Quote:You have a broken copy of IE, in that case. [smile]
Original post by Chris81
That's never worked for me in IE.
Maybe I am thinking of something else, I'm almost positive height=100% did not work for something in IE. It's been a while since I've done daily web development.
Quote:
Original post by benryves Quote:
Original post by Chris81 Quote:
Original post by benryves Quote:
Original post by Chris81
You will need to write some javascript to make this table the same height as the page...<!--QUOTE--></td></tr></table></blockquote><!--/QUOTE--><!--ENDQUOTE-->...or just set <tt>height="100%"</tt> next to the width.<!--QUOTE--></td></tr></table></blockquote><!--/QUOTE--><!--ENDQUOTE--><br/><br/>That's never worked for me in IE.<!--QUOTE--></td></tr></table></blockquote><!--/QUOTE--><!--ENDQUOTE-->You have a broken copy of IE, in that case. [smile]<!--QUOTE--></td></tr></table></blockquote><!--/QUOTE--><!--ENDQUOTE--><br/><br/>Why rely on non standard html in order to get the job done? height="100%" shouldn't work in any standards compliant browsers. It is a hack and should be avoided, especialy when there is a validating css alternative.<br/><br/>Edit: <a href="http://www.apptools.com/examples/tableheight.php">More Info</a>
Quote:So width="100%" is valid and height="100%" isn't? Both work in every browser on this PC, and if the "standards" argument is one to go by I'd have to question why one, and not the other is acceptable...
Original post by tstrimp
Why rely on non standard html in order to get the job done? height="100%" shouldn't work in any standards compliant browsers. It is a hack and should be avoided, especialy when there is a validating css alternative.
I tried laying something out with divs and CSS but gave up as the only ways to get it work in every browser was to use browser hacks (differing box models screwing things up). Stick it all in tables and it looks cleaner (code-wise), and looks and works the same in every browser I throw it at. *sighs*
Quote:
Original post by benryves Quote:So width="100%" is valid and height="100%" isn't? Both work in every browser on this PC, and if the "standards" argument is one to go by I'd have to question why one, and not the other is acceptable...
Original post by tstrimp
Why rely on non standard html in order to get the job done? height="100%" shouldn't work in any standards compliant browsers. It is a hack and should be avoided, especialy when there is a validating css alternative.
I tried laying something out with divs and CSS but gave up as the only ways to get it work in every browser was to use browser hacks (differing box models screwing things up). Stick it all in tables and it looks cleaner (code-wise), and looks and works the same in every browser I throw it at. *sighs*
Ever try using it with a doc type? Ever try using a doc type? divs CAN be a lot cleaner looking then tables depending on how they are implimented.
Quote:
Original post by benryves
I tried laying something out with divs and CSS but gave up as the only ways to get it work in every browser was to use browser hacks (differing box models screwing things up). Stick it all in tables and it looks cleaner (code-wise), and looks and works the same in every browser I throw it at. *sighs*
I tried the one I posted a bit ago in firefox and IE6, worked fine for those.
Quote:
Original post by Chris81
http://www.velocehosting.com/test.html
Quote:
Original post by Chris81 Quote:
Original post by benryves
I tried laying something out with divs and CSS but gave up as the only ways to get it work in every browser was to use browser hacks (differing box models screwing things up). Stick it all in tables and it looks cleaner (code-wise), and looks and works the same in every browser I throw it at. *sighs*
I tried the one I posted a bit ago in firefox and IE6, worked fine for those.Quote:
Original post by Chris81
http://www.velocehosting.com/test.html
This one would be perfect if it weren't for having problems with pages that extend over the pages height. It will effectivly stop after 100% of the window even though the page could be 500% of the window in height. :
Quote:
Original post by WanMaster
If I understand correctly, I had the same problem not that long ago.
If you look here, you see a gradient background. It's pretty much composed in the same way: half the screen has one shade of gray, the other half has a darker shade of gray, and I centered a "layer" with the gradient background image on top of that. This way I'm certain it will show correctly, no matter what screen resolution.
I've extracted a lighter version here, to show the basic idea (blue and red instead of black and white). Just see if you can use it.
This is probably what I'll do...
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement