{"id":939,"date":"2015-01-29T07:12:46","date_gmt":"2015-01-29T13:12:46","guid":{"rendered":"http:\/\/cssnewbie.com\/?p=939"},"modified":"2015-01-29T07:12:46","modified_gmt":"2015-01-29T13:12:46","slug":"basics-tutorial-border-radius-css","status":"publish","type":"post","link":"https:\/\/cssdeck.com\/blog\/basics-tutorial-border-radius-css\/","title":{"rendered":"The Basics of Border-Radius in CSS"},"content":{"rendered":"<p>Border radius can be an excellent way to improve the visual effects. In addition, it can add lively effect to the webpage. However, here in this article, we are going to discuss about the cleverer ways of using the border-radius in CSS.<br \/>\nHowever, elements can be given rounded corners by the application of the border-radius in the CSS. It will be noticed if there is a change of color. Here is a simple example:<\/p>\n<pre>\n.div {\n  border-radius: 10px;\n  background: #BADA55;\n}\n<\/pre>\n<p>And just to cover yourself for multiple browsers (Friefox, and older browsers), you should include:<\/p>\n<pre>\n.div {\n  border-radius: 10px;\n  background: #BADA55;\n-moz-border-radius: 10px; \n-webkit-border-radius: 10px; \n}\n<\/pre>\n<p>You can also create circles out of elements <strong>including images<\/strong>. For example, let&#8217;s say you have:<\/p>\n<pre>&lt;img src=\"arnold.png\"&gt;<\/pre>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2015\/01\/Arnold-Schwarzenegger-Recites-Lines-Reddit.jpg\"><\/p>\n<p>You can add:<\/p>\n<pre>\nimg {\nborder-radius: 50%;\n-moz-border-radius: 50%; \n-webkit-border-radius: 50%; \n}\n<\/pre>\n<p>And the result is<br \/>\n<img decoding=\"async\" src=\"\/wp-content\/uploads\/2015\/01\/Arnold-Schwarzenegger-Recites-Lines-Reddit.jpg\" style=\"border-radius: 50%;\"><\/p>\n<p>You can do the same for images in the background of elements, but you&#8217;ll have to play with the sizing of the elements and the subsequent clipping:<\/p>\n<pre>\n.div {\n  border-radius: 20px;\n  background: url(bglines.png); \/* will get clipped *\/\n}\n<\/pre>\n<p>You can also user border-radius in combination with the border property:<\/p>\n<pre>\n.div {\nborder-radius: 50%;\nbackground: #666;\nborder: 5px solid #000;\nwidth: 150px;\nheight: 150px;\n}\n<\/pre>\n<p>That results in:<\/p>\n<div style=\"border-radius: 50%; background: #666; border: 5px solid #000; width: 150px; height 150px;max-height: 150px;margin: 10px;min-height: 150px;\"><\/div>\n<p>We&#8217;ll dive deeper into border-radius in future posts, but these are the basics!<\/p>\n<div class=\"wp-socializer wpsr-share-icons \" data-lg-action=\"show\" data-sm-action=\"show\" data-sm-width=\"768\" ><h3>Share and Enjoy !<\/h3><div class=\"wpsr-si-inner\"><div class=\"wpsr-counter wpsrc-sz-32px\" style=\"color:#000\"><span class=\"scount\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook,twitter,linkedin,pinterest,print,pdf\">0<\/span><\/span><small class=\"stext\">Shares<\/small><\/div><div class=\"socializer sr-popup sr-32px sr-circle sr-opacity sr-pad sr-count-1 sr-count-1\"><span class=\"sr-facebook\"><a rel=\"nofollow\" href=\"https:\/\/www.facebook.com\/share.php?u=\" target=\"_blank\"  title=\"Share this on Facebook\"  style=\"color: #ffffff\" ><i class=\"fab fa-facebook-f\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-twitter\"><a rel=\"nofollow\" href=\"https:\/\/twitter.com\/intent\/tweet?text=%20-%20%20\" target=\"_blank\"  title=\"Tweet this !\"  style=\"color: #ffffff\" ><i class=\"fab fa-twitter\"><\/i><\/a><\/span>\n<span class=\"sr-linkedin\"><a rel=\"nofollow\" href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=\" target=\"_blank\"  title=\"Add this to LinkedIn\"  style=\"color: #ffffff\" ><i class=\"fab fa-linkedin-in\"><\/i><\/a><\/span>\n<span class=\"sr-pinterest\"><a rel=\"nofollow\" href=\"https:\/\/www.pinterest.com\/pin\/create\/button\/?url=&amp;media=&amp;description=\" target=\"_blank\"  title=\"Submit this to Pinterest\"  style=\"color: #ffffff\" data-pin-custom=\"true\"><i class=\"fab fa-pinterest\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"pinterest\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-print\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Print this article \"  style=\"color: #ffffff\" ><i class=\"fa fa-print\"><\/i><\/a><\/span>\n<span class=\"sr-pdf\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Convert to PDF\"  style=\"color: #ffffff\" ><i class=\"fa fa-file-pdf\"><\/i><\/a><\/span><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Border radius can be an excellent way to improve the visual effects. In addition, it can add lively effect to the webpage. However, here in this article, we are going to discuss about the cleverer ways of using the border-radius [&#8230;]<\/p>\n<p><a class=\"more-link article\" href=\"https:\/\/cssdeck.com\/blog\/basics-tutorial-border-radius-css\/\" title=\"Click to read 'The Basics of Border-Radius in CSS'\">Read Article<\/a><\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[168],"tags":[],"_links":{"self":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/939"}],"collection":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/comments?post=939"}],"version-history":[{"count":0,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/939\/revisions"}],"wp:attachment":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/media?parent=939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/categories?post=939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/tags?post=939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}