CSS Rounded Images

Please Share On:

Definition:

By default, an image is shown in rectangular views. If you want to change your image into rounded images, use the border-radius property. The border-radius property changes each side of the image edge according to your border-radius value.

50% border radius property value makes your image into rounded images.

See an example below which uses a border-radius of 50%.

Rounded Images

Syntax:

img {
  border-radius: 50%;
}

Source Code:

<!DOCTYPE html>
<html>
  <head>
    <style>
      img {
        border-radius: 50%;
      }
    </style>
  </head>
  <body>
    <h2>Rounded Images</h2>
    <img src="https://www.elsebazaar.com/blog/wp-content/uploads/2020/11/Sunset-Harbour-Bridge-View.jpg" alt="Sunset Harbour Bridge" width="300" height="300">
  </body>
</html>

Output

Click “TRY IT YOURSELF” to see the results.

Try yourself by changing the property value to 10%, 20%, or your custom values to see the differences.


Donate to support writers.


You may be interested in the following topics:

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright @2023. All Right Reserved.


Social media & sharing icons powered by UltimatelySocial