How do we insert an image named img.jpg present in the folder outside the parent folder?
<img src="../img.jpg">
<img src="img.jpg">
None of the options
<img src="parent/img.jpg"
None of the options provided answer the question correctly. To insert an image named "img.jpg" present in a folder outside the parent folder, you would use the following code:
<img src="../img.jpg">
This code uses the "../" notation to indicate that the "img.jpg" file is located in a folder one level above the current parent folder.
The correct option for inserting an image named img.jpg present in the folder outside the parent folder would be:
<img src="../img.jpg">
In order to insert an image named "img.jpg" present in a folder outside the parent folder, you would use the option:
<img src="../img.jpg">
Explanation:
The "../" in the src attribute of the <img> tag is used to go up one level in the folder directory structure. By using "../", you can navigate to the folder outside the parent folder. So, the image source would be "../img.jpg". This tells the browser to look for the "img.jpg" file in the folder that is one level above the current folder.
The other options are incorrect:
- <img src="img.jpg"> assumes that the "img.jpg" file is present in the same folder as the HTML file. This option would only work if the image is present in the same folder.
- <img src="parent/img.jpg"> assumes that the "img.jpg" file is present in a subfolder named "parent" within the current folder. This option would only work if the image is present in the specified subfolder.