HTML & CSS for Beginners: From Basic to Advanced by R. Raphael
Author:R., Raphael
Language: eng
Format: epub
Published: 2023-12-14T00:00:00+00:00
Chapter 8: Working with Images and Multimedia
In this chapter, you will learn how to embed images and multimedia content, such as audio and video, into your web pages. Proper use of images and multimedia is key to creating engaging and dynamic pages.
Embedding Images on Web Pages
Images are essential visual elements on web pages. Here are some ways to incorporate images into your content:
1. `< img >` Element: The `< img >` element is used to display images on a page. You can specify the image path using the ` src` attribute .
``` html
< img src ="image.jpg" alt ="Image Description">
```
src` attribute points to the image file.
- The ` alt` attribute provides alternative text for accessibility and is displayed if the image cannot be loaded.
2. Responsive Images: To ensure that images fit different screen sizes, you can use the responsive images technique with the ` max-width` property in CSS.
``` css
img {
max-width : 100%;
height : auto;
}
```
Audio and Video in HTML5
HTML5 introduced native elements to embed audio and video on your web pages. Here are the main elements:
1. `< audio >`: Use the `< audio >` element to embed audio files.
``` html
< audio controls >
< source src ="audio.mp3" type =" audio / mpeg ">
Your browser does not support audio playback.
</ audio >
```
- The ` controls ` attribute adds playback controls.
- You can provide multiple audio formats to ensure compatibility with different browsers.
2. `< video >`: Use the `< video >` element to embed video files.
``` html
< video controls >
< source src ="video.mp4" type =" video /mp4">
Your browser does not support video playback.
</ video >
```
- The ` controls ` attribute adds playback controls.
- Just like audio, you can provide multiple video formats for greater compatibility.
Incorporating External Content
In addition to images, audio and video, you can embed external content such as Google maps or social media posts using embed code provided by the relevant service.
Conclusion
In this chapter, you learned how to embed images and multimedia content into your web pages. Proper use of images, audio and video is crucial to making your pages more attractive and interactive. You also discovered how to create responsive images and embed audio and video using HTML5 elements. As we progress through this book, you'll explore advanced techniques for making your multimedia content even more engaging.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Ada | Ajax |
Assembly Language Programming | Borland Delphi |
C & C++ | C# |
CSS | Compiler Design |
Compilers | DHTML |
Debugging | Delphi |
Fortran | Java |
Lisp | Perl |
Prolog | Python |
RPG | Ruby |
Swift | Visual Basic |
XHTML | XML |
XSL |
Hello! Python by Anthony Briggs(9384)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9352)
The Mikado Method by Ola Ellnestam Daniel Brolund(9321)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(7858)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7411)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7348)
Grails in Action by Glen Smith Peter Ledbrook(7303)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7124)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(5968)
Kotlin in Action by Dmitry Jemerov(4653)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(3912)
Functional Programming in JavaScript by Mantyla Dan(3726)
Learning Java by Patrick Niemeyer & Daniel Leuck(2873)
Mastering Python for Finance by Weiming James Ma;(2852)
Learning React: Functional Web Development with React and Redux by Banks Alex & Porcello Eve(2844)
Windows APT Warfare by Sheng-Hao Ma(2760)
WordPress Plugin Development Cookbook by Yannick Lefebvre(2625)
Mastering Java 9 by Dr. Edward Lavieri(2576)
Architecting Modern Java EE Applications: Designing lightweight, business-oriented enterprise applications in the age of cloud, containers, and Java EE 8 by Daschner Sebastian(2564)