其實通過一點小的調整則可以將兩者兼顧。我們需要兩張圖片:
1
2
看看這段。h1標簽對搜索引擎依然可讀,我們只是利用text-indent:-9999px;將“邀請好友加入”的文字遠遠的扔到左邊去了。
代碼如下:
<style> .test{} .test h1{margin:0; padding:0; text-indent:-9999px; width:522px; height:45px; background:url(header.gif) no-repeat;} .testbox{background:url(bg.gif); width:522px; height:323px;} </style> <div class="test"> <h1>邀請好友加入</h1> </div> <div class="testbox"></div>
<!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>h1標簽的使用</title> <style> .test{} .test h1{margin:0; padding:0; text-indent:-9999px; width:522px; height:45px; background:url(https://www.gxlcms.com/upload/20071124114047865.gif) no-repeat;} .testbox{background:url(https://www.gxlcms.com/upload/20071124114047678.gif); width:522px; height:323px;} </style> </head> <body> 正確使用h1標簽,兼顧美觀與seo. <div class="test"> <h1>邀請好友加入</h1> </div> <div class="testbox"></div> </body> </html>
h1標簽還可以這樣使用,當然你也可以對h1標簽使用樣式比如字體大小,字體顏色之類的,當然像上面例子,只是為了達到seo的目的,就不需要使用樣式對h1標簽進行修改了,因為顯示在用戶面前的是一張圖片。
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com