freeCodeCamp/guide/portuguese/html/attributes/img-width-attribute/index.md

791 B

title localeTitle
Img Width Attribute Atributo Img Width

Atributo Img Width

O atributo "largura" do HTML se refere à largura de uma imagem. O valor nas cotações é a quantidade de pixels.

Por exemplo, se você já tiver um link para uma imagem configurada por meio do atributo src poderá adicionar o atributo width da seguinte forma:


<!DOCTYPE html> 
 <html lang="en"> 
  <head> 
    <title>Img Width Attribute</title> 
  </head> 
  <body> 
    <img src="image.png" alt="Image" width="100"/> 
  </body> 
 </html> 

No snippet de código acima, há uma tag de imagem e a imagem é definida para uma largura de 100 pixels. width="100"

Mais Informações:

Artigo do MDN sobre a tag img