css 兼容问题
DaiRB 2009-05-19 01:49:43 麻烦大家看下, 我这段代码有什么问题. 能正常显示, 目的是 一行显示5个图片。 在我机器上没问题, IE FireFox 都正常。 当在有些笔记本上面就 是一行显示4个图片。 什么原因?
for (int i = ((currentPage - 1) * onePageCont); i < (currentPage * onePageCont); i++)
{
if (i >= photoVector.size())
{
break;
}
photo = photoVector.get(i);
imgUrl = photoUrl + photo.getPath();
int w = photo.getWidth();
int h = photo.getHeight();
int nw = 100;
int nh = (nw * h) / w;
if (nh > 100)
{
nh = 100;
nw = (nh * w) / h;
}
int marginTop = 0, marginLeft = 0;
if (nw > nh)
{
marginTop = ((100 - nh) - (100 - nh) % 2) / 2;
}
else if (nw < nh)
{
marginLeft = ((100 - nw) - (100 - nw) % 2) / 2;
}
//out.print("<div style='clear:both; margin-left:50px; margin-top:5px;'>删除</div>");
out
.print("<div style='float:left; margin-left:30px; margin-top:10px; '><div style='border:solid 1px #BBBBBB; width:100px; height:100px;'><a href='"
+ pictureUrl
+ photo.getId()
+ "'><img style='margin-top:"
+ marginTop
+ "px;margin-left:"
+ marginLeft
+ "px; width:" + nw + "px; height:" + nh + "px; ' src='" + imgUrl + "' border=0 /></a></div></div>");
}