How TO – Avatar Images


Previous


Next

Learn how to create an avatar image with CSS.





Avatar Images

Avatar
Avatar

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

<!DOCTYPE html>
<html>
<head>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<style>
.avatar {
vertical-align: middle;
width: 50px;
height: 50px;
border-radius: 50%;
}
</style>
</head>
<body>

<h2>Avatar Images</h2>

<img src=”img_avatar.png” alt=”Avatar”>
<img src=”img_avatar2.png” alt=”Avatar”>

</body>
</html>


Previous


Next

Scroll to Top