I can ONLY modify CSS, not HTML, on an app I’m using, and I’ve run into an interesting problem:
The app generates 4 cells per row, but I want only 1 cell per row. If I set the width of the TD to 90%, it seems to work, pushing each TD onto it’s own “line.”
It works, that is, in Chrome, Safari, Opera and Firefox browsers. IE seems to try to force the row/cell model. Is there any way I can accomplish this? It’s tough to find an answer in a search engine.
It seems that you are using the emulate ie7 meta tag which is why that page isn’t working in IE8 as the float method doesn;t work in IE7. Remove the emulate meta tag.
http://wildfireapp.com/fb/3139/contests/101081/voteable_entries/list?order=votes
Name Content
Content-type text/html; charset=utf-8
Content-language en
Content-Style-Type text/css
Content-Script-Type text/javascript
[B]X-UA-Compatible IE=EmulateIE7[/B]
By its very definition, TDs are all in the same line.
Since you want each TD to be in its own line, like a block element, you could display the whole table as a block… keep in mind that it would not act as a table anymore.
so doing something like .yourtable td { display: block}
if you can make it so that your data only goes to the first cell in a row ( then your it would look like each cell has its own line) and you could hide the other cells by using
.mytable td+td{display:none;}
Also note that that code targets ALL cells in the table, and ones in specific rows… for that you would need to be able to add a class to the TR tag.
I think it’s worth noting that I already had td set to block, which worked for 4 out of 5 browsers. IE8 and IE9 failed, and I’m sure IE7 would too.
Would it be worth setting display:block at the table level? I misread someone’s post and thought that was what they were suggesting and was hopeful, but now I doubt it would work anyway.
The code I gave you above works for IE8 (and probably Ie9). Just use float instead.
td {width:100%;float:left;clear:left}
Would it be worth setting display:block at the table level? I misread someone’s post and thought that was what they were suggesting and was hopeful, but now I doubt it would work anyway.
No we tried all variations of that and nothing works for ie7 and under I’m afraid.
Thanks…this DID work! I hope I’m not asking too much, but is it possible to set the td width to 90% and center them horizontally within the tr? I’m guessing not, since the tr doesn’t really know what it is anymore, but I was able to accomplish it with my first solution in all browsers but IE.
Did you try it? Quite a few of us are specification junkies, but when it comes to nut cracking time, the answer lies in doing it and looking for the reason it worked or not later.
Another thing to try is to center a block element within the td.