How To Insert Image in HTML Element
buayaberdiri.blogspot.com - If you want to add an image or photo for the background image to the html element, then you can use the code <img>
Example of writing html code :
<img src="image.png" alt="example image">
The img tag only has 2 attributes :
- src
- alt
the src code is used to call where the image is stored in a certain folder, while the alt code is used to provide a brief description of the displayed image.
If the saved image is outside the html folder, it is necessary to call where the folder came from
<img src="C:/Users/Jamal/Documents/001HTML/img/aset01.png" alt="example image" height="100" width="100">
Setting Image Height and Width in HTML
In the <img> code we can provide the required image height and width, below we can set the height and width using the code <style>
<img src="image.png" alt="example image" style="height:100px; width: 100px">
in the style code, we can add width and height properties, width is to set image width and height is to set image height. The unit that we use to determine the size of the height and width is px or read pixels.
Or you can set the height and width of the image like this:
<img src="image.png" alt="example image" height="100" width="100">