简体   繁体   English

Firefox中的宽度百分比问题

[英]Problem with width in percentage in Firefox

I have problem with width using percentage in Mozilla Firefox. 我在Mozilla Firefox中使用百分比的宽度有问题。

In Firefox: 在Firefox中: 替代文字

In Opera: 在Opera中: 替代文字

Code

    <!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=iso-8859-1">
    <meta name="author" content="adminite">

    <title>Untitled 2</title>
    <style>
    #cont {
    width:99.8%;
    height:125px;
    border:1px solid red;
    background-color:#1ea1de;
    margin: 0px 0px 0px 0px;
}</style>
</head>

<body>

<div id="cont">

</div>

</body>
</html>

A possibility is that you haven't reseted the browser default styles. 您可能没有重置浏览器的默认样式。

Try: 尝试:

html, body{
  margin: 0;
  padding: 0;
}

If that's the case, you might benefit from using a reset stylesheet such as this one: 如果是这种情况,则可以使用以下重置样式表来受益:

http://meyerweb.com/eric/tools/css/reset/ http://meyerweb.com/eric/tools/css/reset/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM