2017-09-10 84 views
0

我有一張紙的背景div,我想用一些段落來寫在紙上。我已經將邊距設置爲零,並且我將行間距設置爲25.5px,並且適用於Firefox,但在Chrome上非常適用。有什麼具體原因嗎?爲什麼行間距不一樣?

這裏是兩個並排的圖像:

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'; 
} 
https://cdn.discordapp.com/attachments/172018499005317120/356360953392136192/unknown.png

這裏是代碼一點點

這裏是一個活的版本,如果需要的話:http://lano-project.org/update/home/

編輯:增加現場版本。

回答

0

也許你沒有重置margin,padding,line-height和這些屬性的初始值...所以瀏覽器的行爲有所不同。 可以肯定的是,逐個檢查元素,看看它們從哪裏繼承它們的樣式。

谷歌「CSS重置」瞭解更多信息。 有一些預先重置,你可以從這裏得到這些: cssreset.com 或寫你自己的最小版本。

編輯:

另外一個固定的背景大小添加到#paper元件。

+0

添加css重置後,它似乎幫助了一些,但它仍然有點像鉻是添加一個像素到每一行。你認爲自定義字體是搞亂了嗎? –

+0

不,我認爲這是因爲比率(背景圖像高度與線高度 - > 946÷25.5 = 37.09像素)數字有小數,在第一行之前還有一個額外的空間,所以首先您應該測量背景圖像一個素描應用。問題在於背景。 – Pooria