Src attribute
The HTML src attribute specifies the URL or path of an external resource that an element retrieves, displays, plays, 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 →
Related concepts
- img elementused by · The HTML img element embeds an image resource in a document.
- video elementused by · The HTML video element embeds and plays video content while exposing playback controls and media state to scripts.
- attributekind of · An attribute is a named property, value, or piece of information associated with an entity, object, or program element.
- audio elementused by · The HTML audio element embeds audio content in a web page and supports its playback, optionally with user controls.
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.

