CSS Triangle 三角形



You can make them with a single div. It’s nice to have classes for each direction possibility.

<div class="arrow-up"></div>
<div class="arrow-down"></div>
<div class="arrow-left"></div>
<div class="arrow-right"></div>


The idea is a box with zero width and height. The actual width and height of the arrow is determined by the width of the border. In an up arrow, for example, the bottom border is colored while the left and right are transparent, which forms the triangle.

.arrow-up {
  width: 0; 
  height: 0; 
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid black;

.arrow-down {
  width: 0; 
  height: 0; 
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 20px solid #f00;

.arrow-right {
  width: 0; 
  height: 0; 
  border-top: 60px solid transparent;
  border-bottom: 60px solid transparent;
  border-left: 60px solid green;

.arrow-left {
  width: 0; 
  height: 0; 
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent; 
  border-right:10px solid blue; 


[codepen_embed height=”300″ theme_id=”0″ slug_hash=”lotjh” default_tab=”result” user=”chriscoyier”]See the Pen Animation to Explain CSS Triangles by Chris Coyier (@chriscoyier) on CodePen.[/codepen_embed]


1392 评论 在 "CSS Triangle 三角形"

排序:   最新 | 最旧 | 得票最多

5iswfJ your about-all dental treatment? This report can empower you way in oral cure.

There is noticeably a bundle to understand about this. I assume you made certain nice points in capabilities also.

Wow! Thank you! I always wanted to write on my site something like that. Can I include a portion of your post to my blog?

Way cool! Some extremely valid points! I appreciate you penning this article and also the rest of the website is very good.

Im grateful for the blog.Thanks Again. Much obliged.

Very useful information specifically the last part I care for such information much.

It抯 hard to find knowledgeable folks on this topic, however you sound like you know what you抮e speaking about! Thanks

We stumbled over here from a different web address and thought I might check things out. I like what I see so i am just following you. Look forward to looking over your web page repeatedly.

After examine a few of the blog posts in your website now, and I truly like your approach of blogging. I bookmarked it to my bookmark website listing and can be checking back soon. Pls try my web page as properly and let me know what you think.

Your method of telling everything in this article is genuinely pleasant, all can without difficulty know it, Thanks a lot.

you can also give your baby some antibacterial baby socks to ensure that your baby is always clean`

My wife and i got relieved John could carry out his studies via the precious recommendations he obta… 阅读更多 »

Your style is really unique in comparison to other folks I have read stuff from. Many thanks for posting when you have the opportunity, Guess I all just book mark this site.

Nothing is more admirable than the fortitude with which millionaires tolerate the disadvantages of their wealth.

Wow, superb blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is great, let alone the content!. Thanks For Your article about sex.

written. In my opinion, it might bring your website a little bit more interesting.

Thanks for sharing, this is a fantastic blog post.Really thank you! Really Cool.

Muchos Gracias for your blog.Much thanks again. Awesome.

It as not that I want to replicate your web site, but I really like the design. Could you let me know which style are you using? Or was it custom made?

very nice put up, i actually love this website, carry on it

Looking forward to reading more. Great blog article. Really Great.

pretty valuable stuff, overall I consider this is really worth a bookmark, thanks

You made some decent points there. I looked on the internet for the topic and found most people will agree with your website.

Ultimately, an issue that I am passionate about. I have looked for data of this caliber for the very last various hrs. Your website is tremendously appreciated.

Appreciate you sharing, great post. Keep writing.

its really really nice post on building up new website.

A big thank you for your article post.Much thanks again. Keep writing.

There is definately a lot to find out about this subject. I love all the points you ave made.

wow, awesome post.Really looking forward to read more. Fantastic.

There is evidently a bundle to know about this. I consider you made some good points in features also.

Great blog post.Much thanks again.

Thanks again for the article.Thanks Again. Fantastic.

Thanks again for the article.Much thanks again. Awesome.

Thanks a lot for giving everyone remarkably breathtaking chance to read in detail from this web site. It really is very useful and full of a lot of fun for me and my office peers to search your blog on the least 3 times in one week to read the new secrets you have. Not to mention, I am also certainly happy with your awesome knowledge served by you. Selected two ideas in this post are surely the simplest we have all had.

Wow, great blog article.Really looking forward to read more. Will read on

Really informative blog article.Really thank you! Will read on…

You got a very great website, Gladiola I observed it through yahoo.

Muchos Gracias for your blog article.Thanks Again. Cool.

Way cool! Some very valid points! I appreciate you penning this post and also the rest of the site is extremely good.

Aw, this was a really nice post. In idea I want to put in writing like this moreover ?taking time and precise effort to make an excellent article?however what can I say?I procrastinate alot and on no account seem to get one thing done.

Great, thanks for sharing this article.Thanks Again. Cool.

I went over this internet site and I conceive you have a lot of excellent information, saved to my bookmarks (:.

Im grateful for the blog article. Will read on…

Thanks so much for the blog.Really thank you! Want more.

I really liked your blog post.Much thanks again. Will read on…

Thank you ever so for you blog article.Really looking forward to read more. Awesome.

Really appreciate you sharing this blog.Thanks Again. Great.

Thanks for all your efforts that you have put in this. Very interesting info. A good man can be stupid and still be good. But a bad man must have brains. by Maxim Gorky.

I really liked your blog post.Thanks Again. Really Great.

Very informative blog article.Thanks Again. Cool.