top of page
Writer's pictureThe Tech Platform

Change the Shape of the Image using CSS

In CSS, Use the border-radius property to create rounded images:

You can Change the shape of the image using pixels or using percentage value.


Below are two examples .


Lets see


1. Border-radius : 200px;


<!DOCTYPE html>
<html>
<head>
<style>
img {
  border-radius: 20px;
}
</style>
</head>
<body>

<h2>Rounded Images</h2>
<p>border-radius property with pixels value:</p>

<img src="paris.jpg" alt="Paris" width="300" height="300">

</body>
</html>




2. Border-radius : 50%


<!DOCTYPE html>
<html>
<head>
<style>
img {
  border-radius: 50%;
}
</style>
</head>
<body>

<h2>Rounded Images</h2>
<p>border-radius property with percentage value:</p>

<img src="paris.jpg" alt="Paris" width="300" height="300">

</body>
</html>




Resources: W3School


The Tech Platform


0 comments

Recent Posts

See All

Comments


bottom of page