簡體   English   中英

如何驗證此html?

[英]How do I validate this html?

我為一家公司設計了一個網站,並且一切正常。 我決定我最好還是驗證整個事情,所以我一直在消除錯誤。 但是,我遇到了一個似乎無法解決的問題。
這是錯誤

Line 86, Column 106: Bad value 105px for attribute height on element img: Expected a digit but saw p instead.

Line 86, Column 106: Bad value 216px for attribute width on element img: Expected a digit but saw p instead.


這是線

<p class="centeredImage"><img src="images/logo.png" height="105px" width="216px" alt="ATS Logo"><img src="images/header1.png" alt="ATS Header"></p>


我正在使用centeredImage的p類將兩個圖像顯然放在div中。 我以為刪除兩個'p'標簽會解決它,但仍然給我同樣的錯誤。 實際的高度和寬度屬性似乎有問題。

有人可以告訴我這里發生了什么以及如何解決?

widthheight屬性與CSS無關。 他們只是期待一個數字。

鏈接: http//www.w3.org/wiki/HTML/Elements/img

身高與默認情況下在PX表示加入“PX”到設定值,使驗證錯誤。 您應該這樣寫標簽:

<img src="images/logo.png" height="105" width="216" alt="ATS Logo">

高度和寬度被解釋為像素。 如果您需要寬度或高度作為空間的百分比,則必須在數字后添加“%”。

height和width屬性不需要“ px”即可http://www.w3schools.com/tags/att_td_height.asp

你用過

height="105px" width="216px"

而應該是

height="105" width="216"

不要在那里使用px。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM