Featured Article

W3Schools Image Source Guide Master HTML Image Src Examples

Adam Jul 13, 2026

When it comes to learning web development, W3Schools is a go-to resource for many. One essential aspect of web design is handling images, and W3Schools provides a comprehensive guide on how to use and manipulate images in your HTML and CSS. This guide will delve into the intricate world of images on W3Schools, exploring everything from image sources to CSS styling.

two kids standing in front of school building with clock on the wall and door open
two kids standing in front of school building with clock on the wall and door open

Images are a vital part of any website, enhancing user experience and providing visual context. W3Schools offers step-by-step guides and examples to help you understand and implement image usage effectively.

a group of people sitting around a table with laptops and books on it,
a group of people sitting around a table with laptops and books on it,

Understanding Image Sources on W3Schools

Images in HTML require a source, which is specified within the tag using the src attribute. W3Schools teaches you how to use both absolute and relative URLs as image sources.

three children are standing in front of speech bubbles and looking at something on the phone
three children are standing in front of speech bubbles and looking at something on the phone

Absolute URLs, like , point to the image's location on the internet. Relative URLs, like images/boat.png, are used when the image is stored locally, relative to the HTML file's location.

Absolute URLs

three girls in school uniforms are looking at a book and smiling while standing next to each other
three girls in school uniforms are looking at a book and smiling while standing next to each other

The absolute URL specifies the image's complete address on the internet. W3Schools showcases how to use absolute URLs, including correct formatting and common errors to avoid.

Here's a simple example from W3Schools: . Notice that the URL starts with "https://" and ends with the image's file extension, ".png".

Relative URLs

there is a woman teaching in front of the class with laptops on desks
there is a woman teaching in front of the class with laptops on desks

Relative URLs, as taught by W3Schools, are used when the image is stored locally, relative to the HTML file's location.

For instance, if you have a folder named "images" in the same directory as your HTML file, and inside that folder is an image called "boat.png", you would use . Here, the src attribute points to the image's location relative to the HTML file.

W3Schools also provides extensive tutorials on using CSS to format and style images, allowing you to truly make them your own.

School Products, Happy Kids In Classroom, Happy Children At School, Elementary School Photography, Marketing Photos, School Photography, Educational Projects, Santa Clara, Photography Inspo
School Products, Happy Kids In Classroom, Happy Children At School, Elementary School Photography, Marketing Photos, School Photography, Educational Projects, Santa Clara, Photography Inspo

After learning how to add images to your website, the next step is to make them look exactly how you want. W3Schools teaches you how to change an image's size, alignment, border, and more using CSS.

Changing Image Size

an artist's rendering of students walking in front of a building with the words university on it
an artist's rendering of students walking in front of a building with the words university on it
a man in graduation cap and gown sitting at a desk with a laptop on it
a man in graduation cap and gown sitting at a desk with a laptop on it
a group of young people sitting around a table with laptops and drinks in front of them
a group of young people sitting around a table with laptops and drinks in front of them
a red school building with the word school on it's front door and trees
a red school building with the word school on it's front door and trees
a group of young people standing next to each other holding books and smiling at the camera
a group of young people standing next to each other holding books and smiling at the camera
Cute School Kids 3D Cartoon Scene 🏫✨
Cute School Kids 3D Cartoon Scene 🏫✨
there are many children sitting at desks with their hands in the air
there are many children sitting at desks with their hands in the air
Educational Tax Guide, Education Tax Credits And Deductions, Tax Credits For Education, Tax Benefits For Education, Irs Tax Benefits For Education, Irs Education Tax Credits, Irs Education Tax Credits 2025, Teaching Juneteenth To Children, Understanding Child Rights Conventions
Educational Tax Guide, Education Tax Credits And Deductions, Tax Credits For Education, Tax Benefits For Education, Irs Tax Benefits For Education, Irs Education Tax Credits, Irs Education Tax Credits 2025, Teaching Juneteenth To Children, Understanding Child Rights Conventions
a group of young people sitting around a table with laptops in front of them
a group of young people sitting around a table with laptops in front of them
a group of children sitting at desks with their hands in the air
a group of children sitting at desks with their hands in the air
Back to School
Back to School
an illustration of a teacher teaching students on laptops
an illustration of a teacher teaching students on laptops
several children sitting at desks in a classroom with notebooks and papers on them
several children sitting at desks in a classroom with notebooks and papers on them
several people are standing on books flying in the air with ladders to reach them
several people are standing on books flying in the air with ladders to reach them
three school kids standing in front of the school bus
three school kids standing in front of the school bus
школа онлайн
школа онлайн
a school building with a clock on top of it and the words school written below
a school building with a clock on top of it and the words school written below
an old black and white photo of children running in front of a school
an old black and white photo of children running in front of a school
classroom and students
classroom and students

W3Schools demonstrates how to change an image's size using CSS. You can set the width and height of an image using pixels, percentages, or even viewports. Here's a simple example: .

W3Schools also teaches the importance of maintaining aspect ratio when changing an image's size to avoid distortion.

Image Alignment

W3Schools teaches how to align images using CSS. You can left-align, right-align, or center an image using the float property or text-align property, respectively. For example, aligns the image to the right.

W3Schools also shows how to create a clearfix to clear floated elements and maintain the layout's integrity.

By learning from W3Schools' comprehensive guides on image sources and styling, you can enhance your web development skills and create visually appealing websites. Whether you're a beginner or an experienced developer, there's always more to learn about images on W3Schools. So, start exploring today and unleash your creativity!