Skip to content

rule img width height

Hanxing Yang edited this page Jul 10, 2016 · 1 revision

name

img-width-height

description

Attribute width & height of <img> is recommended to be set, which can reduce re-layout while rendering. If found not set, it reports.

sample

<!-- Bad -->
<img src="./sample.jpg">
<img src="./sample.jpg" width="">
<img src="./sample.jpg" height="">
<img src="./sample.jpg" width="100">
<img src="./sample.jpg" height="100">
<img src="./sample.jpg" width="100" height="">
<img src="./sample.jpg" height="100" width="">

<!-- Good -->
<img src="./sample.jpg" height="100" width="100">

code

  • 015

    Attribute width and height of <img> found not set.

  • 016

    Attribute width of <img> found not set.

  • 017

    Attribute height of <img> found not set.

config

  • true

    Do check / format.

  • false

    Do not check / format.

format support

No.

Clone this wiki locally