样式表:如何让firefox达到与ie一样的显示效果

WorldCreater 2010-01-06 12:06:45
以下的代码在 firefox 中显示和在 ie 中不同,
应怎样更改才能使得在firefox中与在ie中显示一个样?
-------------------------------------------------------
<html>
<head>
<title>Wecome</title>
</head>
<table border="0" width="100%">
<tr>
<td colspan="3">
<span style="font: oblique bold xx-large; color: chocolate">Company</span>
</td>
<td>${viewCart}
</td>
</tr>

<tr style="background: chocolate;font: oblique medium; color: white">
<td width="25%">Home</td>
<td width="25%">Product</td>
<td width="25%">Service</td>
<td width="25%">Contact Us</td>
</tr>
</table>
<body>
</body>
</html>

...全文
154 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
WorldCreater 2010-01-06
  • 打赏
  • 举报
回复
又试了下,必须要用这个声明

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=${encoding}">
这样字体才一样
WorldCreater 2010-01-06
  • 打赏
  • 举报
回复
加这个样式,效果也是不同
<style>
* {margin:0px;padding:0px; overflow:auto;}
</style>
firefox里的字瘦
WorldCreater 2010-01-06
  • 打赏
  • 举报
回复
我在頁面第一行加了 dtd 聲明好象也沒多大的變化,
style我改写了下,效果还是不同,
在 firefox 里字好象比在 ie 里瘦 比如“company"那段的style

===============================
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Wecome </title>
</head>
<table border="0" width="100%">
<tr>
<td colspan="3">
<span style="font-style:oblique; font-weight:bold; font-size:60px; color:chocolate">Company </span>
</td>
<td>${viewCart}
</td>
</tr>

<tr style="background:chocolate; font-style:oblique; font-size:20px; color:white">
<td width="25%">Home </td>
<td width="25%">Product </td>
<td width="25%">Service </td>
<td width="25%">Contact Us </td>
</tr>
</table>
<body>
</body>
</html>
xcf007 2010-01-06
  • 打赏
  • 举报
回复
要想ie/ff一样,最起码的,上来就得保证DTD声明

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

没有它,ie会按怪癖模式渲染页面,这样的css盒模型是不标准的。
dage619 2010-01-06
  • 打赏
  • 举报
回复
这就要自己调试了,不同的浏览器解析肯定有差别了。
lzz624 2010-01-06
  • 打赏
  • 举报
回复
<style>
* {margin:0px;padding:0px; overflow:auto;}
</style>
加个CSS就一样了

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧