How do I add image to my web page?

  • Thread starter Math10
  • Start date
  • Tags
    Image Web
In summary: It is simply a text description of it. You can skip it and come back to it later if you need to.In summary, to add an image to a web page, you need to use the img element and specify the source of the image using the src attribute. If the image is in the same directory as the HTML page, simply enter the file name between the quotation marks. If the image is in a different directory, you will need to provide the full path and file name. The alt attribute is optional and provides alternate text for the image in case it cannot be displayed.
  • #1
Math10
301
0

Homework Statement


How do I add image to my web page?

Homework Equations


None.

The Attempt at a Solution


I know that the img element is <img src="logo.png" alt="My Logo"> but I don't know what to type between the 2 quotation marks for "logo.png" and "My Logo". I put logo.png and My Logo between them but it doesn't work. What should I input between " " and " "?
 
Physics news on Phys.org
  • #2
Math10 said:

Homework Statement


How do I add image to my web page?

Homework Equations


None.

The Attempt at a Solution


I know that the img element is <img src="logo.png" alt="My Logo"> but I don't know what to type between the 2 quotation marks for "logo.png" and "My Logo". I put logo.png and My Logo between them but it doesn't work. What should I input between " " and " "?
If logo.png is in the same directory as the HTML page that contains this img element, what you have should work. If the file is in some other directory, you need to supply the path and file name.

The alt attribute is alternate text to display in case the viewer's browser is unable to download the image. You can put in there pretty much whatever you want.
 
  • #3
As Mark44 said, but let me elaborate.

Is your picture online right now? Are you able to see it somewhere? If so, how? You must have a URL that points to it. (the address in your address bar of your browser).

The URL is what you put in the src="". There are subtleties, but that's the gist of it.

Don't worry about alt too much just yet. It is not essential to displaying your image.
 

Related to How do I add image to my web page?

1. How do I add an image to my web page using HTML?

To add an image to your web page using HTML, you can use the <img> tag. This tag requires two attributes: src, which specifies the URL of the image, and alt, which provides a text description of the image for accessibility purposes.

2. Can I add an image from my computer to my web page?

Yes, you can add an image from your computer to your web page using HTML. You will need to use the src attribute to specify the file path of the image on your computer. Keep in mind that this will only work for images that are stored on your local computer and may not display for others who view your web page.

3. How do I resize an image in HTML?

To resize an image in HTML, you can use the width and height attributes within the <img> tag. These attributes accept values in pixels, percentages, or other units of measurement.

4. Is there a way to add a caption to an image in HTML?

Yes, you can add a caption to an image in HTML by using the <figure> and <figcaption> tags. The <figure> tag is used to group the image and caption together, while the <figcaption> tag is used to specify the caption text.

5. How can I make my images responsive in HTML?

To make your images responsive in HTML, you can use the max-width: 100% CSS property on the <img> tag. This will ensure that the image scales down proportionally to fit within its container, making it responsive to different screen sizes.

Similar threads

  • Programming and Computer Science
Replies
23
Views
4K
  • Programming and Computer Science
Replies
32
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
848
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Programming and Computer Science
Replies
3
Views
958
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
Replies
9
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
18
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
755
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
Back
Top