XHTML網頁圖片應用
合理的添加圖片可以使一個網頁更加的美觀。
圖片標簽<img>
<img>標簽用于在網頁里插入圖片。<img>標簽有一個重要的屬性"src",它的屬性值就是圖片的地址。下面我們就在我們的index.html里插入一個圖片。打開”index.html“文件,在</body>前加上如下代碼:
| <p><img src="http://images.sj33.cn/uploads/allimg/200712/20071224141723713.gif" border=0 cellSpacing=0 cellPadding=6 width="95%" align=center> |
| <p><a ><img src="http://images.sj33.cn/uploads/allimg/200712/20071224141723713.gif"alt="技術支持"/></a>< /p> |
保存后瀏覽網頁,請再次確認您的網頁與這個網頁相同。看看圖片是不是變成了超級鏈接,點擊一下圖片就會進入菜鳥吧的主頁了。
關于XHTML的效驗
從本節開始我們就不再修改"index.html"這個網頁的外觀了,現在將我們制作的網頁送交權威機構檢驗一下。首先進入:http: //validator.w3.org/,該頁面就是一個XHTML效驗工具,它用來檢驗我們制作的網頁是否符合XHTML的標準。您可以選擇用網址效驗,也可以上傳文件效驗。您可以選擇文件上傳效驗,方法如下:
在”Validate by File Upload“有“Local File”一欄,點擊瀏覽,找到并選中之前保存的"index.html",然后點擊“check”按鈕。您的結果應該與我們通過網址效驗的結果一樣。返回如下錯誤信息:
| Sorry, I am unable to validate this document because on line 3, 6-9, 12-14, 16-22 it contained one or more bytes that I cannot interpret as utf-8 (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication. |
難道我們的網頁不符合XHTML標準嗎?請繼續看下一節的內容。
標簽:







