为什么线间距不一样?

时间:2017-09-10 09:18:50

标签: css google-chrome firefox

我有一张背景为一张纸的div,我想用一些段落写在纸上。我已将边距设置为零,并且我将行间距设置为25.5px,并且在Firefox上完美运行,但在Chrome上。有具体原因吗?

这是两个并排的图像:https://cdn.discordapp.com/attachments/172018499005317120/356360953392136192/unknown.png

这里有一些代码:

HTML

<div id="paper">
    <h1>LANO Project</h1>
    <p>Welcome to the 5th rebuild of LANO Project. I hope you like all of the upgrades that have been going on. I have worked very hard on this update to make it look very clean and avaliable for the future. I tried my best to address issues that I have noticed in the past while pushing a fun interface for the user while still making it easy for the developer to add, update, change, and sometimes remove things. I was going for a 90's theme, things that you find in the 90's.</p>
    <p>In future updates (hopefully thoses exist) I will be adding a few more entirely unnessissary physics to some of the elements found in this website. I really want my own website (this one) to be a great example of what I can do / make as a webdeveloper. I will also be adding any games I make on this site.</p>
    <p>To get started just click on the tiles in the navigation bar.</p>
</div>

CSS

#paper{
    background: url("../home/paper.png");
    margin-left: auto;
    margin-right: auto;
    width: 658px;
    height: 946px;
}
#paper h1{
    margin: 0px;
    color: #333333;
    font-size: 36px;
    padding-top: 75px;
    padding-left: 110px;
    padding-right: 30px;
    padding-bottom: 16px;
    font-family: 'write_bold';
}
#paper p{
    margin:0px;
    line-height: 1.1;
    font-size: 20px;
    color: #333333;
    text-indent: 20px;
    padding-left: 103px;
    padding-right: 30px;
    font-family: 'write';
}

如果需要,这是一个实时版本:http://lano-project.org/update/home/

编辑:添加了实时版本。

1 个答案:

答案 0 :(得分:0)

可能你没有重置边距,填充,行高和这些属性的初始值......所以浏览器的行为方式不同。 可以肯定的是,逐个检查元素并看到它们从哪里继承它们的样式。

Google&#34; CSS重置&#34;欲获得更多信息。 有一些预先写好的重置你可以从这里获得: cssreset.com 或者编写自己的最小版本。

修改

还为#paper元素添加固定的背景大小。