问题
This is a follow up on my previous question (ListView - ItemTemplate table styling). I am still trying to make the ItemTemplate look like this:
______________________________________________
| |___________Title_____________|
| Image |____________Name_____________|
| |______Value_____|____Value___|
|_______________|______Value_____|____Value___|
It works perfectly in Chrome and Opera but there are problems in the other browsers.
Firefox:
______________________________________________
| _____________ | |
|| Image | | |
|| | | |
||____________| |___________Title_____________|
| |____________Name_____________|
| |______Value_____|____Value___|
|_______________|______Value_____|____Value___|
IE:
______________________________________________
| _____________ |___________Title_____________|
|| Image ||____________Name_____________|
|| ||______Value_____|____Value___|
||_____________|| | |
| | | |
|_______________|______Value_____|____Value___|
In Safari it displays like in IE plus it adds a HUGE gap above it.
Here is the output of the page and the CSS http://jsfiddle.net/9HsvF/21/ I would appreciate any help!
回答1:
Just a suggestion. Get rid of the tables if possible. And try a div layout. A layout template output can be like (http://jsfiddle.net/V5aCa/1/):
<div style="overflow:auto;">
<div class="leftColumn">
<img src="http://static.adzerk.net/Advertisers/da748a4c6e9b4c97af37c32af7531544.jpg"/>
</div>
<div class="rightColumn">
<div class="titleRow">Title</div>
<div class="nameRow">Name</div>
<div class="values">
<div>value1</div><div>value2</div>
</div>
<div class="values">
<div>value3</div><div>value4</div>
</div>
</div>
</div>
and the css:
.leftColumn
{
float:left;
width:150px;
overflow:auto;
}
.rightColumn
{
float:left;
overflow:auto;
}
.titleRow,.nameRow
{
text-align:center;
}
.values
{
clear:both;
}
.values div
{
float:left;
padding:0px 3px;
}
来源:https://stackoverflow.com/questions/14671772/listview-item-template-styling-cross-browser-differences