To create a circular image using CSS, you can use the border-radius
property. Here's a simple example:
html<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.circular-image {
width: 100px; /* Adjust the size of your image */
height: 100px; /* Adjust the size of your image */
border-radius: 50%; /* Make it a perfect circle by setting the border-radius to 50% */
overflow: hidden; /* Hide overflow content outside the circle */
}
</style>
</head>
<body>
<div class="circular-image">
<img src="your-image.jpg" alt="Your Image">
</div>
</body>
</html>
In this example:
border-radius: 50%
is used to make the container a perfect circle.overflow: hidden
property ensures that any content outside the circle is hidden.Adjust the width
and height
values as per your requirements, and don't forget to replace "your-image.jpg" with the actual path to your image.