TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Animation to Explain CSS Triangles

227 pointsby grinnickover 11 years ago

21 comments

javajoshover 11 years ago
Man, this is a powerful teaching technique - I knew all this, but I don't think I really really understood it until just now. I hope more people start writing animated explanations for web stuff. Maybe someone could do one for CSS menu systems or side bar, sticky footer, type stuff. Or even the Bootstrap grid system.
kmmover 11 years ago
I'm sorry, I have very little experience with web design, but is this the supposed way to create a triangle? It seems weird there would be no way to build shapes with primitives.
评论 #6512478 未加载
评论 #6512616 未加载
评论 #6513371 未加载
评论 #6512477 未加载
JungleGymSamover 11 years ago
I vote we change the name from CSS to PWL. PWL is, of course, Puzzle Web Language. This is what I hate about CSS: it&#x27;s a jigsaw puzzle that must be brute-forced.<p>The fact that this exists and is lauded as clever rather than being ridiculed for its opaqueness really gets my goat.
评论 #6512858 未加载
评论 #6515567 未加载
gp-over 11 years ago
▼ ◀ ▶ ▲<p>Some more - <a href="http://www.fileformat.info/info/unicode/block/geometric_shapes/list.htm" rel="nofollow">http:&#x2F;&#x2F;www.fileformat.info&#x2F;info&#x2F;unicode&#x2F;block&#x2F;geometric_shap...</a>
评论 #6514481 未加载
silveiraover 11 years ago
I&#x27;m the only one here that although thinks it is a cool presentation fells sad about how a triangle needs to be described as a very broken rectangle?
评论 #6512449 未加载
评论 #6512617 未加载
babbyover 11 years ago
Note: You only need to specify 3 borders.<p>Eg. a triangle pointing down:<p><pre><code> .triangle-down { border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 7px solid #444; }</code></pre>
评论 #6513284 未加载
评论 #6512957 未加载
jimmcslimover 11 years ago
At YOW Australia 2012, Brian Beckman and Erik Meijer gave an entertaining presentation about &#x27;The Story of the Teapot in HTML&#x27;. I thought it was going to culminate in a 3d animation of a teapot in a browser using Javascript and CSS triangles, but they didn&#x27;t get that far.<p>Anyway, here&#x27;s a link to the video: <a href="http://yow.eventer.com/yow-2012-1012/the-story-of-the-teapot-in-html-by-brian-beckman-and-erik-meijer-1266" rel="nofollow">http:&#x2F;&#x2F;yow.eventer.com&#x2F;yow-2012-1012&#x2F;the-story-of-the-teapot...</a>
评论 #6513321 未加载
twanlassover 11 years ago
Ahhh the hatin&#x27; HN crowd. For what it&#x27;s worth - I&#x27;ve built this bit of CSS over and over but seeing so uniquely presented was great. Thanks for that.
scottcanoniover 11 years ago
Now animate this using a border with an inner color like this:<p><a href="http://cssarrowplease.com/" rel="nofollow">http:&#x2F;&#x2F;cssarrowplease.com&#x2F;</a>
评论 #6513549 未加载
kamakazizuruover 11 years ago
I find it depressing how most of CSS related drawing is basically all just hacks. I saw the same a few weeks ago when someone posted a bunch of different CSS shapes - the code behind it was the most unintuitive stuff. It&#x27;s like saying - here&#x27;s a bicycle - now lets get another one and weld it together in some ugly way and make a car out of it. I dont understand why CSS &#x2F; Browsers have not come far enough to natively support basic shapes? Surely if we can make self-driving cars - rendering things in browsers should be simpler? (yes I am aware of SVG &amp; Canvas - but they dont work everywhere - dont get why the good folks at google , ms &amp; mozilla cant get together and agree that the web shouldnt be full of ugly hacks masquerading as stylesheets).
评论 #6515937 未加载
karamover 11 years ago
Sweet. Thanks for making this. It&#x27;d be awesome if you could extend the animation and show examples of complex shapes you could make with triangles.
评论 #6512745 未加载
rimantasover 11 years ago
Reminded me of good old one: <a href="http://www.designdetector.com/tips/3DBorderDemo2.html" rel="nofollow">http:&#x2F;&#x2F;www.designdetector.com&#x2F;tips&#x2F;3DBorderDemo2.html</a> For other cool abuse of CSS see <a href="http://cssdeck.com/labs/creating-single-element-iphone-using-css3" rel="nofollow">http:&#x2F;&#x2F;cssdeck.com&#x2F;labs&#x2F;creating-single-element-iphone-using...</a>
joeheymingover 11 years ago
I wish all CSS was described this way... Thanks!
cstratover 11 years ago
Very cool!<p>I always knew how it worked but it was nice to see the animation play out.
Theriac25over 11 years ago
Somehow I&#x27;m tempted to click the &quot;report abuse&quot; button.
periferralover 11 years ago
I had no idea. Thanks for the very cool animation&#x2F;explanation. A+
dingdingdangover 11 years ago
Honestly, why is there no basic web drawing app out there that exports to CSS? Should be doable and hence done.
评论 #6515192 未加载
评论 #6515974 未加载
评论 #6514204 未加载
sprokolopolisover 11 years ago
I always sort of wondered about this, but I never got around to investigating it. Thanks for the lesson.
zerovoxover 11 years ago
Does this mean if you create a 100px high triangle, it has 100px of invisible padding on top?
评论 #6512554 未加载
GoldfishCRMover 11 years ago
Simple, elegant and to the point. Give me more stuff like this.
ozhover 11 years ago
Designer: <i>&quot;wow this is cool&quot;</i><p>HN reader who&#x27;s not a designer: <i>&quot;don&#x27;t like, bleh CSS, should SVG, used to do that in VIM, TIMTOWTDI&quot;</i> and other similar useless rants missing the point.
评论 #6515025 未加载