Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying DIV like a table

Status
Not open for further replies.

jb13

Programmer
Oct 12, 2006
11
CA
Hi everyone,

I readed some articles on the web on how to display DIV elements in a table format. All these articles said the same thing, that this code should display a table with a single line and 3 columns because display:table = <table>,
display:table-row = <tr>, and display:table-cell = <td>.
Code:
<div style="display: table">
	<div style="display: table-row">
		<div style="display: table-cell">1</div>
		<div style="display: table-cell">2</div>
		<div style="display: table-cell">3</div>
	</div>
</div>

But when i test it, it doesn't work, even the example in these articles is not working, and i use IE 6.0

Someone can tell me what's wrong ?
 
IE supports only [tt]inline, block and none[/tt] for display values. Anyway, what you are doing is complete and utter nonsense and you should either:

1. Use actual table tags if it is tabular data you're having.
2. Re-think your page not to use table for layout.
 
Of course this was just a sample, because in my real page the style attribute will be replaced by a class and i would like to have the information sometimes displayed in a row, sometime displayed in a column, depending on which css sheet is loaded with the page.

Anyway i know now why it was not working, thank you.
 
... Internet Explorer doesn’t support the display:table, display:table-row and display:table-cell properties...

See discussion and example at Equal height boxes with css at 456 Berea Street.



Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
You could do it this way:

Code:
<div id="myTable">
    <div id="myRow">
        <div style="float:left">1</div>
        <div style="float:left">2</div>
        <div style="float:left>3</div>
    </div>
</div>

Please note that the id's are only to identify what's what ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top