{"id":388,"date":"2019-08-03T14:13:11","date_gmt":"2019-08-03T14:13:11","guid":{"rendered":"https:\/\/www.blindemanwebsites.com\/today-i-learned\/?p=388"},"modified":"2019-08-03T19:11:24","modified_gmt":"2019-08-03T19:11:24","slug":"css-triangles","status":"publish","type":"post","link":"https:\/\/www.blindemanwebsites.com\/today-i-learned\/2019\/css-triangles\/","title":{"rendered":"CSS triangles"},"content":{"rendered":"<p><strong>What:<\/strong> Making triangles using CSS<\/p>\n<p><strong>How:<\/strong> The basic idea is a box with width and height set to zero.<br \/>\nYou set the four borders, three of which you make transparent.<br \/>\nBorder-width then decides the size of the triangle and giving the different sides different border-widths changes the shape of the triangle.<!--more--><\/p>\n<p><strong>Thoughts:<\/strong> You don&#8217;t have to set the border-color to transparent. You have to make the sides you don&#8217;t want to see invisible. For <a href=\"https:\/\/cssbattle.dev\/play\/34\" target=\"_blank\" rel=\"noopener noreferrer\">CSSBattle 7 target 34<\/a> I set the border-color for the sides I didn&#8217;t want to see to the background-color of the container, because a hex color value takes less characters than the word <em>transparent<\/em>.<br \/>\nIf you&#8217;re using it on a live site though, setting it to transparent is probably better. If the background-color of the container changes you won&#8217;t have to change the border-color and the container might not have a solid color as a background, it might have a photo or a pattern as a background.<\/p>\n<h3>Codepen: CSS triangles<\/h3>\n<p>[codepen_embed height=&#8221;362&#8243; theme_id=&#8221;0&#8243; slug_hash=&#8221;WVZMYw&#8221; default_tab=&#8221;result&#8221; user=&#8221;blindeman&#8221;]See the Pen &lt;a href=&#8217;https:\/\/codepen.io\/blindeman\/pen\/WVZMYw\/&#8217;&gt;CSS triangles&lt;\/a&gt; by Naomi Blindeman (&lt;a href=&#8217;https:\/\/codepen.io\/blindeman&#8217;&gt;@blindeman&lt;\/a&gt;) on &lt;a href=&#8217;https:\/\/codepen.io&#8217;&gt;CodePen&lt;\/a&gt;.[\/codepen_embed]<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Read more:<\/strong> <a href=\"https:\/\/css-tricks.com\/snippets\/css\/css-triangle\/\" target=\"_blank\" rel=\"noopener noreferrer\">@CSS-TRICKS by Chris Coyier<\/a><\/p>\n<hr \/>\n<div class=\"_3bJ2H CHExY\">\n<div class=\"_1l8RX _1ByhS\">Photo by <a href=\"https:\/\/unsplash.com\/@zuizuii?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\" target=\"_blank\" rel=\"noopener noreferrer\">Duy Hoang<\/a> on <a href=\"https:\/\/unsplash.com\/search\/photos\/triangle?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\" target=\"_blank\" rel=\"noopener noreferrer\">Unsplash<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>What: Making triangles using CSS How: The basic idea is a box with width and height set to zero. You set the four borders, three of which you make transparent. Border-width then decides the size of the triangle and giving the different sides different border-widths changes the shape of the triangle.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[25,17,28,27],"class_list":["post-388","post","type-post","status-publish","format-standard","hentry","category-new-things","tag-codepen","tag-css","tag-cssbattle","tag-triangles","infinite-scroll-item"],"_links":{"self":[{"href":"https:\/\/www.blindemanwebsites.com\/today-i-learned\/wp-json\/wp\/v2\/posts\/388","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.blindemanwebsites.com\/today-i-learned\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.blindemanwebsites.com\/today-i-learned\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.blindemanwebsites.com\/today-i-learned\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.blindemanwebsites.com\/today-i-learned\/wp-json\/wp\/v2\/comments?post=388"}],"version-history":[{"count":0,"href":"https:\/\/www.blindemanwebsites.com\/today-i-learned\/wp-json\/wp\/v2\/posts\/388\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.blindemanwebsites.com\/today-i-learned\/wp-json\/wp\/v2\/media?parent=388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blindemanwebsites.com\/today-i-learned\/wp-json\/wp\/v2\/categories?post=388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blindemanwebsites.com\/today-i-learned\/wp-json\/wp\/v2\/tags?post=388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}