<img> 태그 속성에 대한 질문입니다.
조회수 1988회
제가 validator로 통해서 에러검증을 받는데
Error: Bad value 48px for attribute width on element img: Expected a digit but saw p instead. dd>↩ <img src="images/additional-info-icon-warranty-mo.png" alt="" width="48px" > height="48px">↩
width
랑 height
의 값에 숫자 px
를 쓰면 에러라고 하는데 이게 왜 에러인지 궁금합니다 .
그리고 "Expected a digit but saw p instead."
이것이 무엇을 의미하는 건지도 궁금합니다.
-
(•́ ✖ •̀)
알 수 없는 사용자 - 〉
1 답변
-
안녕하세요 성중원님 :) 야무입니다.
HTML 문서에 작성하는 요소의
width
,height
속성에는 픽셀이 기본 값이기에 단위를 사용하지 않습니다. 픽셀이 아닌 경우는 단위 값을 붙여 사용할 수 있습니다.<img src="http://image.zdnet.co.kr/2018/04/05/kunst_ddc8FxzPFEhv79.jpg" alt="서울 시내 KEB하나은행 신축 본점 전경.(사진=KEB하나은행)" width="620" height="921"> <iframe width="560" height="315" src="https://www.youtube.com/embed/UMCw0ZgUYms" allowfullscreen></iframe>
The IMG (Image) Element, W3C 이전 HTML3 버전의 문서 내용을 살펴보면 다음과 같은 내용이 나옵니다. 픽셀은 기본 값이기에 단위를 붙여 사용할 필요가 없습니다. HTML5 또한 픽셀 단위를 제거하길 권장하는 것으로 보입니다.
WIDTH 이미지 너비(width)를 설정. (기본적으로 px(pixels) 사용됨) Optional suggested width for the image. By default, this is given in pixels. HEIGHT 이미지 높이(height)를 설정. (기본적으로 px(pixels) 사용됨) Optional suggested height for the image. By default, this is given in pixels. UNITS 선택적으로 width, height 속성 값에 단위를 사용할 수 있음. en (포인트 크기의 절반) This optional attribute specifies the units for the width and height attributes. It is one of: units=pixels (the default) or units=en (half the point size).
-
(•́ ✖ •̀)
알 수 없는 사용자
-
댓글 입력