By using a simple CSS property called border-radius, we can bend the pictures’ square/rectangular shaped edges into a circular shape. Increasing border-radius to 50% brings the required shape to the picture.
Setting the border-radius alone will leave the picture with no border or bezel around it. It would look like something like this:
The code to display the above image is as follows:
CSS:
<style>.rpic img{
border-radius: 50%;
} </style>
HTML:
<div class="rpic">
<img src="http://pkfast.com/image.php?u=6018&dateline=1422394928"/>
</div>
The width of the bezel (border-style) can be modified by using the regular border-width property in CSS. So, the resultant CSS becomes this:
<style>
.rpic img{
border-radius: 50%;
border-style: solid;
border-width: 5px;
}
</style>
While the HTML remains the same.
Result: (Watch the following picture with border-style and border-width properties added to the code)
border-style can be ‘dotted’, ‘dashed’, ‘double’, ‘groove’, ‘ridge’, ‘inset’, ‘outset’ other than ‘solid’. You can even use their combo like as ‘dotted solid double dashed’ and it will be applied clockwise starting from the top edge. Take a look at this example (opens in new tab) on W3Schools for a better idea.
The border style color of the picture can also be modified using the border-color property.
When added, the resultant code will look at this:
<style>
.rpic img{
border-radius: 50%;
border-width: 5px;
border-style: solid;
border-color: #09aacc;
}
</style>
Value for border-color property can be the name of the color, hexadecimal code or rgb(0,0,0) values.
Result:
Hope that was made simple. Don’t forget to share with me your beautiful rounded profile picture in the comments section below.
very helpful codes
ReplyDeleteAwesome stuff. Pretty useful codes. Keep posting stuffs like this :)
ReplyDeleteThank you!
ReplyDeleteThank you so much! Will bring more good stuff like this for sure :) Just stay tuned!
ReplyDeleteWOw Bro this is really a nice one.
ReplyDeleteI know this is not easy for bloggers on blogspot. It comes easy on wp but blogspot bloggers always have probs in this.
Thanks for elaborating.
Have a nice day bro
Hello Sasidhar,
ReplyDeletePretty awesome information you shared! So easy for a person with no coding know-how like myself. :)
Oh and one question hits me hard in mind; will the same code work for WordPress?
Thanks! And I am happy to share it! :)
~ Adeel
Blogger supports all the HTML, CSS, JS and its all extension technologies as well as WP. The advantage of WP over blogger is it is a CMS that gives more control over the content. That's it, it has never been so difficult coding for Blogger ever.
ReplyDeleteGlad you liked it bro! Thank you so much for sharing your thoughts about it :)
Hi Adeel bro,
ReplyDeleteYes! it perfectly works on WordPress too! Blogging platforms supports HTML, CSS and JS technologies very well.
It makes me happy to know that you found it easy even being a non-programmer. Thank you for sharing your questions about it. I'd be happy to answer further more queries if you had any.
Thank you for shaing it to your social network as well.
Post a Comment