{"id":2367,"date":"2023-09-16T10:16:41","date_gmt":"2023-09-16T03:16:41","guid":{"rendered":"https:\/\/dev.artru.io.vn\/?p=2367"},"modified":"2023-11-12T12:35:17","modified_gmt":"2023-11-12T05:35:17","slug":"tao-round-out-borders","status":"publish","type":"post","link":"https:\/\/artru.net\/en\/tao-round-out-borders\/","title":{"rendered":"Create Round Out Borders"},"content":{"rendered":"<p>Rounded corners can now be easily implemented via properties <code data-no-translation=\"\" data-no-auto-translation=\"\">border-radius<\/code>. On the contrary, if you want to round the &quot;outer&quot; corners, you need to customize a few more steps to get the desired result.<\/p>\n\n\n\n<p>You can search for the keyword &quot;Round Out Borders&quot; to learn more methods.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">For example: the natural state when the corners are not rounded.<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"313\" height=\"313\" src=\"https:\/\/cdn.artru.eu.org\/wp-content\/uploads\/2023\/09\/Chua-bo-goc.png\" alt=\"No corners yet\" class=\"wp-image-2383\"\/><figcaption class=\"wp-element-caption\">No corners yet<\/figcaption><\/figure>\n<\/div>\n\n\n<pre class=\"wp-block-code\" data-no-translation=\"\" data-no-auto-translation=\"\"><code data-no-translation=\"\" data-no-auto-translation=\"\">&lt;div class=\"div-outer\"&gt;\n  &lt;div class=\"div-inner\"&gt;\n    &lt;div class=\"div-inner-2\"&gt;\n      &lt;!-- Contents --&gt;\n    &lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;\n&lt;style&gt;\n  .div-outer{\n    width: 300px;\n    height: 300px;\n    background-color: #c3c3c3;\n  }\n  .div-inner{\n    width: 50%;\n    height: 50px;\n    background-color: gray;\n  }\n&lt;\/style&gt;<\/code><\/pre>\n\n\n\n<p>In this case I usually use pseudo elements <code data-no-translation=\"\" data-no-auto-translation=\"\">::before, ::after<\/code> to create &quot;outer&quot; corner fillets. But you need 4 pseudo elements to do this. Since pseudo-elements in CSS cannot be created multiple times, I was forced to create 1 more <code data-no-translation=\"\" data-no-auto-translation=\"\">div-inner-2<\/code>.<\/p>\n\n\n\n<p>According to the problem, we need to create &quot;outer&quot; corner fillets in 2 locations <code data-no-translation=\"\" data-no-auto-translation=\"\">Top-Right<\/code> and <code data-no-translation=\"\" data-no-auto-translation=\"\">Bottom-Left<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Draw a circle at the corner to be covered with the ::before pseudo element<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"313\" height=\"313\" src=\"https:\/\/cdn.artru.eu.org\/wp-content\/uploads\/2023\/09\/Ve-hinh-tron-tai-goc-bo-ngoai.png\" alt=\"Draw a circle at the outer corner\" class=\"wp-image-2386\"\/><figcaption class=\"wp-element-caption\">Draw a circle at the outer corner<\/figcaption><\/figure>\n<\/div>\n\n\n<pre class=\"wp-block-code\" data-no-translation=\"\" data-no-auto-translation=\"\"><code data-no-translation=\"\" data-no-auto-translation=\"\">&lt;div class=\"div-outer\"&gt;\n  &lt;div class=\"div-inner\"&gt;\n    &lt;div class=\"div-inner-2\"&gt;\n      &lt;!-- Contents --&gt;\n    &lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;\n&lt;style&gt;\n  .div-outer{\n    width: 300px;\n    height: 300px;\n    background-color: #c3c3c3;\n  }\n  .div-inner{\n    width: 50%;\n    height: 50px;\n    background-color: gray;\n    position: relative;\n  }\n  .div-inner::before{\n    content: \"\";\n    width: 50px;\n    height: 50px;\n    position: absolute;\n    background-color: red;\n    right: -50px;\n    top: 0;\n    border-radius: 50%;\n  }\n  .div-inner-2::before{\n    content: \"\";\n    width: 50px;\n    height: 50px;\n    position: absolute;\n    background-color: red;\n    left: 0;\n    bottom: -50px;\n    border-radius: 50%;\n  }\n&lt;\/style&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Draw an additional square at the corner that needs to be rounded using the ::after pseudo element<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"313\" height=\"313\" src=\"https:\/\/cdn.artru.eu.org\/wp-content\/uploads\/2023\/09\/Ve-hinh-vuong-tai-goc-bo-ngoai.png\" alt=\"Draw a square at the outer corner\" class=\"wp-image-2389\"\/><figcaption class=\"wp-element-caption\">Draw a square at the outer corner<\/figcaption><\/figure>\n<\/div>\n\n\n<pre class=\"wp-block-code\" data-no-translation=\"\" data-no-auto-translation=\"\"><code data-no-translation=\"\" data-no-auto-translation=\"\">&lt;div class=\"div-outer\"&gt;\n  &lt;div class=\"div-inner\"&gt;\n    &lt;div class=\"div-inner-2\"&gt;\n      &lt;!-- Contents --&gt;\n    &lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;\n&lt;style&gt;\n  .div-outer{\n    width: 300px;\n    height: 300px;\n    background-color: #c3c3c3;\n  }\n  .div-inner{\n    width: 50%;\n    height: 50px;\n    background-color: gray;\n    position: relative;\n  }\n  .div-inner::before{\n    content: \"\";\n    width: 50px;\n    height: 50px;\n    position: absolute;\n    background-color: red;\n    right: -50px;\n    top: 0;\n    border-radius: 50%;\n  }\n  .div-inner::after{\n    content: \"\";\n    width: 25px;\n    height: 25px;\n    position: absolute;\n    background-color: blue;\n    right: -25px;\n    top: 0;\n  }\n  .div-inner-2::before{\n    content: \"\";\n    width: 50px;\n    height: 50px;\n    position: absolute;\n    background-color: red;\n    left: 0;\n    bottom: -50px;\n    border-radius: 50%;\n  }\n  .div-inner-2::after{\n    content: \"\";\n    width: 25px;\n    height: 25px;\n    position: absolute;\n    background-color: blue;\n    left: 0;\n    bottom: -25px;\n  }\n&lt;\/style&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Set z-index: 10 for the circle, then change the background-color accordingly and you will achieve the result.<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"313\" height=\"313\" src=\"https:\/\/cdn.artru.eu.org\/wp-content\/uploads\/2023\/09\/z-index-cho-hinh-tron.png\" alt=\"z-index for circle\" class=\"wp-image-2381\"\/><figcaption class=\"wp-element-caption\">z-index for circle<\/figcaption><\/figure>\n<\/div>\n\n\n<pre class=\"wp-block-code\" data-no-translation=\"\" data-no-auto-translation=\"\"><code data-no-translation=\"\" data-no-auto-translation=\"\">&lt;div class=\"div-outer\"&gt;\n  &lt;div class=\"div-inner\"&gt;\n    &lt;div class=\"div-inner-2\"&gt;\n      &lt;!-- Contents --&gt;\n    &lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;\n&lt;style&gt;\n  .div-outer{\n    width: 300px;\n    height: 300px;\n    background-color: #c3c3c3;\n  }\n  .div-inner{\n    width: 50%;\n    height: 50px;\n    background-color: gray;\n    position: relative;\n    border-radius: 0px 0px 25px 0px;\n  }\n  .div-inner::before{\n    content: \"\";\n    width: 50px;\n    height: 50px;\n    position: absolute;\n    background-color: #c3c3c3;\n    right: -50px;\n    top: 0;\n    border-radius: 50%;\n    z-index: 10;\n  }\n  .div-inner::after{\n    content: \"\";\n    width: 25px;\n    height: 25px;\n    position: absolute;\n    background-color: gray;\n    right: -25px;\n    top: 0;\n  }\n  .div-inner-2::before{\n    content: \"\";\n    width: 50px;\n    height: 50px;\n    position: absolute;\n    background-color: #c3c3c3;\n    left: 0;\n    bottom: -50px;\n    border-radius: 50%;\n    z-index: 10;\n  }\n  .div-inner-2::after{\n    content: \"\";\n    width: 25px;\n    height: 25px;\n    position: absolute;\n    background-color: gray;\n    left: 0;\n    bottom: -25px;\n  }\n&lt;\/style&gt;<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"313\" height=\"313\" src=\"https:\/\/cdn.artru.eu.org\/wp-content\/uploads\/2023\/09\/Da-bo-goc-ngoai.png\" alt=\"Rounded outer corners\" class=\"wp-image-2392\"\/><figcaption class=\"wp-element-caption\">Rounded outer corners<\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Other examples<\/h2>\n\n\n\n<p class=\"codepen\" data-height=\"300\" data-default-tab=\"html,result\" data-slug-hash=\"JjwJxax\" data-user=\"artrublog\" style=\"height: 300px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\">\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/artrublog\/pen\/JjwJxax\" target=\"_blank\" rel=\"noopener\">\n  Round Out Borders<\/a> by ARTRU (<a href=\"https:\/\/codepen.io\/artrublog\" target=\"_blank\" rel=\"noopener\">@artrublog<\/a>) on <a href=\"https:\/\/codepen.io\" target=\"_blank\" rel=\"noopener\">CodePen<\/a>.<\/span>\n<\/p>\n<script async src=\"https:\/\/cpwebassets.codepen.io\/assets\/embed\/ei.js\"><\/script>","protected":false},"excerpt":{"rendered":"<p>C\u00e1c g\u00f3c bo tr\u00f2n gi\u1edd \u0111\u00e2y c\u00f3 th\u1ec3 d\u1ec5 d\u00e0ng th\u1ef1c hi\u1ec7n th\u00f4ng qua thu\u1ed9c t\u00ednh border-radius. Ng\u01b0\u1ee3c l\u1ea1i, n\u1ebfu b\u1ea1n mu\u1ed1n bo tr\u00f2n g\u00f3c \"b\u00ean ngo\u00e0i\" th\u00ec c\u1ea7n ph\u1ea3i [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2399,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[113],"tags":[],"class_list":["post-2367","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-css"],"_links":{"self":[{"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/posts\/2367","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/comments?post=2367"}],"version-history":[{"count":0,"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/posts\/2367\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/media\/2399"}],"wp:attachment":[{"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/media?parent=2367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/categories?post=2367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/tags?post=2367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}