這篇提供一些常見的錯誤寫法,一方面用來提醒自己用,有時候會犯一些好白痴的錯誤,例如忘記加上單位PX之類的…。

錯誤:

background-image:url('../img/logo.png') center center no-repeat;

正確是:

background: url('../img/logo.png') center center no-repeat;

一般來說可以直接用background: 巴拉巴拉你要的樣式,取代寫一堆background-image、background-repeat、background-position…


使用圖片替換<h1>,又不影響SEO(但目前好像又不行了)

1
2
3
4
5
6
h1 {
text-indent:-9999px;
background:url("title.jpg") no-repeat;
width:100px;
height:50px;
}

推薦閱讀:

20 Useful CSS Tips For Beginners

arrow
arrow
    文章標籤
    CSS
    全站熱搜

    庭喵 發表在 痞客邦 留言(0) 人氣()