How TO - Avatar Images
Learn how to create an avatar image with CSS.





How To Create Avatar Images
Step 1) Add HTML:
Example
<img src="avatar.png" alt="Avatar" class="avatar">
Step 2) Add CSS:
Set a matching height
and width
that looks good, and use the border-radius
property to add rounded corners to an image. 50% will make the image circular:
Example
.avatar {
vertical-align: middle;
width: 50px;
height: 50px;
border-radius: 50%;
}
Try it Yourself »
Go to our CSS Images Tutorial to learn more about how to style images.
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.