Src attribute
The HTML src attribute specifies the URL of an external resource that an element retrieves or embeds.
Web Design Playground, Second Edition
The src attribute specifies the location of the image resource referenced by an HTML img element.
- How it is used
- Locates image, video, or audio files for HTML media elements.
- How deep it goes
- Explains remote URLs, local filenames, paths, placeholders, and multiple media sources without covering server-side file handling.
- Examples
- Uses an image path, a placeholder URL, and single- or multiple-format video and audio markup.
- What you can do after
- Build it into HTML media elements by supplying appropriate filenames, paths, URLs, or source alternatives.
Read how Web Design Playground, Second Edition explains src attribute →
Build a Website with ChatGPT
The src attribute is an HTML attribute that specifies the URL or filename of an embedded resource such as an image.
- How it is used
- Deploys src in HTML image elements to connect a page with an external image file.
- How deep it goes
- Explains filename and subdirectory paths with examples, but does not descend into advanced resource-loading behavior.
- Examples
- Uses logo files, an images subdirectory, and an old-road-marker.jpg photograph to demonstrate resource paths.
- What you can do after
- Apply it by writing image paths in HTML and correcting src when files are renamed or moved.
Read how Build a Website with ChatGPT explains src attribute →
Also covered in
What to know first
- HTMLHTML is the standard markup language for structuring content and elements in documents on the web.
- audioAudio is sound represented as a signal or data that can be stored, transmitted, processed, or reproduced.
- CSSCSS (Cascading Style Sheets) is a stylesheet language for specifying the presentation and layout of structured documents.
- digital imageA digital image is a digital representation of visual content, commonly encoded as an arrangement of pixels or other graphical elements.
Related concepts
- img elementconfigures · The HTML img element embeds an image resource in a document.
- attributekind of · An attribute is a named property or piece of information associated with an entity, object, or structured data item.
- media element interfacepart of · The browser programming interface that exposes properties and methods for controlling audio and video media elements.
- video elementused by · The HTML video element embeds video content in a document and provides media playback functionality and an interface for controlling playback.
Questions about src attribute
What is src attribute?
The HTML src attribute specifies the URL of an external resource that an element retrieves or embeds.
Which Manning books explain src attribute?
Web Design Playground, Second Edition and Build a Website with ChatGPT.
What should I know before learning src attribute?
Manning books that teach src attribute usually introduce HTML, audio, CSS and digital image first.
What is the difference between src attribute and srcset attribute?
The HTML src attribute specifies the URL of an external resource that an element retrieves or embeds. The HTML srcset attribute specifies alternative image resources with descriptors that enable a browser to select an appropriate source.
What is src attribute a kind of?
Src attribute is a kind of attribute. An attribute is a named property or piece of information associated with an entity, object, or structured data item.
What is src attribute part of?
Src attribute is part of media element interface. The browser programming interface that exposes properties and methods for controlling audio and video media elements.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

