My boss wants me to stop using CSS layouts and start using table layouts. A major factor in this is the desirable behavior of tables in horizontally positioned, fluid layouts. See this example:
If you slide the width of the HTML panel narrower, you will see that the table (the first one) has several convenient qualities:
- Automatically finds a good place to split the two cells, giving the cell with more content a larger percentage of the available width.
- Fills all of the available width 100%.
- When deciding which of the cells to wrap, it does so in the way most efficient with regards to vertical space.
- Keeps the two cells aligned horizontally no matter what.
Example A does not have quality 1. (You have to update the ratio by hand if the content size changes.)
Example B does not have quality 1 or 3. (Static 50% is less than ideal but could work. However, it breaks on to 3 lines while the table is still only 2 lines tall.)
Example C does not have quality 2 or 4. (I can see ways to fake quality 2 with this one, but clearing down to the next line is totally a deal breaker.)
Example D does not have quality 1 or 4. (Technically it has 1, but the huge gap in between is not practical. Also, left/right floating on the same line doesn’t work well in some browsers.)
Since the data is not semantically tabular, I really want to avoid using tables. But my boss pays me, so I need to go with what he says or find a better solution. Is there a way to do this using semantic markup and CSS?
Updated: For all browsers > ie7 you can use
display: table, table-row, table-cell. the jQuery code will target ie7 and then replace the div’s with appropriate table elements.If this is the only problem you’ve run into so far, you shouldn’t install some goofy grid system just to fix this. That’s overkill and a waste of time.
http://jsfiddle.net/CoryDanielson/yuNTX/
sample html
IE7fixes.js
You should structure your CSS similar to mine
required css