Forum Moderators: not2easy
<html>
<head>
<style>
td {vertical-align:middle;text-align:center;padding:100px}
.t50{width:50%;}
</style>
</head>
<body>
<table border="1" CELLSPACING=0>
<tr><td colspan=2><img src="images_logo_lg.gif"></td></tr>
<tr>
<td class=t50><img src="images_logo_lg.gif"></td>
<td class=t50><img src="images_logo_lg.gif"></td>
</tr>
<tr><td colspan=2><img src="images_logo_lg.gif"></td></tr>
</table>
</body>
</html>
Many thanks!
js
All depends on what you would have in a real world situation instead of 4 identical images. And if you'd need 4 images arranged like that, it's nearly trivial anyway: just use absolute positioning to paste them anywhere you like.
Give us fully compliant browsers and it all doesn't matter as we can use display:table-* .
The reverse exercise is the one that matters: It's pretty easy to give a CSS example you can't do with tables without using at least some CSS.
Just float a box of text to one side and have a larger box of text wrap around and under it in a fluid manner. There's no way to do that if you need to start by chopping up things in a grid.
Many thanks
js
- Create a main container, assign it a width, center it with margin: auto. If left unassigned, it will default to 100% which can lead to some really wide pages on high resolution monitors. This creates a legibility problem as bad as tiny type (i.e., really wide lines of text.) The max-width property will help if you want to default to 100%.
- You already have a 50% class. I'd **probably** change that to 49% or zero out all padding and margins. Inside the main, float one div left, one right - remember to put the LEFT one first in the source code. (This is just one way - you could also just assign a pixel or em width.)
- The top and bottom divs/images can be a 100% width class.
- You will probably need to put a clearing div/element after the two floated divs.
In any case, use a valid document type [webmasterworld.com] and validate the document [validator.w3.org] and it should fly in all modern browsers.
The first thing to do is NOT to think in terms of a matrix and instead use all the ways to position things on your page. You have in CSS element that can be blocks or can be inline (even inline blocks).
next you can position these elements in a number of ways:
So the best solution really depends on what we want to achieve and what we know about the elements.
No navigation menu ?
And what's in those areas (logo, title, images, ...)
Also what do you want to happen when columns are unequal in length, what do you want to happen if the viewport is rather small, or ridiculously large, ...
Similarly we can all things to make your page centered, at least the height of the viewport etc. but it's all up to you to decide what you want it to look like.
Basically you need to think outside of the table. ;)