Skip to main content
gamedev.net
🔒 Locked

html puzzle.

Started by PumpkinPieman Aug 4, 2005 at 9:36 AM 18 replies 2.1k views
Original Post
PumpkinPieman
PumpkinPieman
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?
Chris81
Chris81
<table width=100%><tr><td bgcolor="black" width="50%"> </td><td bgcolor="white" width="50%"> </td></tr></table>


You will need to write some &#106avascript 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.
Chris81
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.
benryves
benryves
Quote:
Original post by Chris81
You will need to write some &#106avascript 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>
[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]
PumpkinPieman
PumpkinPieman
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 |
|-------|

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 ...
Chris81
Chris81
Quote:
Original post by benryves
Quote:
Original post by Chris81
You will need to write some &#106avascript 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>
PumpkinPieman
PumpkinPieman
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.
dagarach
dagarach
Use CSS to absolutely position the smaller table.
benryves
benryves
Quote:
Original post by Chris81
Quote:
Original post by benryves
Quote:
Original post by Chris81
You will need to write some &#106avascript 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>
[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]
Wan
Wan
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.
Chris81
Chris81
Quote:
Original post by benryves
Quote:
Original post by Chris81
That's never worked for me in IE.
You have a broken copy of IE, in that case. [smile]


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.
tstrimp
tstrimp
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 &#106avascript 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>
benryves
benryves
Quote:
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.
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...
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*
[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]
dagarach
dagarach
My method works fine in both IE and firefox, I don't have safari or opera.
tstrimp
tstrimp
Quote:
Original post by benryves
Quote:
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.
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...
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.
Chris81
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
PumpkinPieman
PumpkinPieman
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.