如何使CSS新的长阴影趋势? [英] How to make the new long shadow trend with CSS?

查看:105
本文介绍了如何使CSS新的长阴影趋势?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出现了一种新趋势,



我真的很喜欢它,现在我想在我的网站上有这样的效果。但我不会做一张图片,我想在CSS做它! (或HTML5,jQuery等)。



我已经找到了一个生成器(

例如:

  .shape {
text-shadow:rgb(20,144,120)1px 1px,
rgb ,144,120)2px 2px,
rgb(20,144,120)3px 3px,
rgb(20,144,120)4px 4px,
rgb 5px 5px,
rgb(20,144,120)6px 6px,
rgb(20,144,120)7px 7px,
rgb(20,144,120)8px 8px,
rgb(20,144,120)9px 9px,
rgb(20,144,120)10px 10px,
rgb(20,144,120)11px 11px,
rgb ,144,120)12px 12px,
rgb(20,145,121)13px 13px,
rgb(20,146,122)14px 14px,
rgb 15px 15px,
rgb(20,148,123)16px 16px,
rgb(20,149,124)17px 17px,
rgb(20,150,125)18px 18px,
rgb(20,151,126)19px 19px,
rgb(21,152,126)20px 20px,
rgb(21,153,127)21px 21px,
rgb ,154,128)22px 22px,
rgb(21,155,129)23px 23px,
rgb(21,156,129)24px 24px,
rgb 25px 25px,
rgb(21,158,131)26px 26px,
rgb(21,159,132)27px 27px,
rgb(22,160,133)
box-shadow:rgb(28,37,48)1px 1px,
rgb(28,37,48)2px 2px,
rgb(28,37,48)3px 3px,
rgb(28,37,48)4px 4px,
rgb(28,37,48)5px 5px,
rgb(28,37,49)6px 6px,
rgb 28,37,49)7px 7px,
rgb(28,38,49)8px 8px,
rgb(28,38,49)9px 9px,
rgb )10px 10px,
rgb(29,38,49)11px 11px,
rgb(29,38,50)12px 12px,
rgb(29,38,50)13px 13px,
rgb(29,38,50)14px 14px,
rgb(29,39,50)15px 15px,
rgb(29,39,50)16px 16px,
rgb 29,39,50)17px 17px,
rgb(29,39,51)18px 18px,
rgb(29,39,51)19px 19px,
rgb )20px 20px,
rgb(30,39,51)21px 21px,
rgb(30,39,51)22px 22px,
rgb(30,40,51)23px 23px,
rgb(30,40,52)24px 24px,
rgb(30,40,52)25px 25px,
rgb(30,40,52)26px 26px,
rgb 30,40,52)27px 27px,
rgb(30,40,52)28px 28px,
rgb(30,40,52)29px 29px,
rgb )30px 30px,
rgb(31,41,53)31px 31px,
rgb(31,41,53)32px 32px,
rgb(31,41,53)33px 33px,
rgb(31,41,53)34px 34px,
rgb(31,41,53)35px 35px,
rgb(31,41,54)36px 36px,
rgb 31,41,54)37px 37px,
rgb(31,42,54)38px 38px,
rgb(31,42,54)39px 39px,
rgb )40px 40px,
rgb(32,42,54)41px 41px,
rgb(32,42,55)42px 42px,
rgb(32,42,55)43px 43px,
rgb(32,42,55)44px 44px,
rgb(32,43,55)45px 45px,
rgb(32,43,55)46px 46px,
rgb 32,43,55)47px 47px,
rgb(32,43,56)48px 48px,
rgb(32,43,56)49px 49px,
rgb )50px 50px,
rgb(33,43,56)51px 51px,
rgb(33,43,56)52px 52px,
rgb(33,44,56)53px 53px,
rgb(33,44,57)54px 54px,
rgb(33,44,57)55px 55px,
rgb(33,44,57)56px 56px,
rgb 33,44,57)57px 57px,
rgb(33,44,57)58px 58px,
rgb(33,44,57)59px 59px,
rgb )60px 60px;
background-color:rgb(22,160,133);
height:150px;
width:150px;
font-size:75px;
line-height:150px;
text-align:center;
}

因此,有一个更简单,更清洁和更好的方式任何图形?






说明为什么我不使用任何图形



我喜欢创意,不寻常和杰出的动画。所以我想,用这个长长的阴影真的是美好的事情可能。



我有一个动画在我心中,我真的想实现:

我有一个文本,如Stackoverflow。我添加这个文本CSS - transition 。当我悬停此文本时,应显示一个平滑的文本阴影

演示中的想法

简单一个。但是这个长阴影会怎么样?这会很棒。但它将是一个巨大的CSS只是这个动画。不合理。



所以我问你聪明的头脑。你知道任何容易的CSS-Trick,或者也许有一种方法来实现这一点与JavaScript或其他图书馆?然后我认为有更多惊人的效果可能比我的小想法...

解决方案

查看本教程如何做与Sass: http://css-tricks.com/metafizzy-effect-with-sass/



,并查看此CodePen的完整结果: http:/ /codepen.io/hugo/pen/nwivF



上面的例子几乎是使用纯CSS做的唯一方法,虽然它看起来相当疯狂 - 它会让你调整这些文本阴影使用过渡等。


Out there is a new trend along with Flat UI called "long shadow".
This is an example picture:

Credit

I really like it and now I want an effect like that on my site. But I won't make a picture, I want to do it in CSS! (Or HTML5, jQuery etc).

I already found a generator for that (Long Shadow Generator by Juani Ruiz Echazú), but the generated CSS looks really really awkward.

Example:

.shape {
    text-shadow: rgb(20, 144, 120) 1px 1px,
    rgb(20, 144, 120) 2px 2px,
    rgb(20, 144, 120) 3px 3px,
    rgb(20, 144, 120) 4px 4px,
    rgb(20, 144, 120) 5px 5px,
    rgb(20, 144, 120) 6px 6px,
    rgb(20, 144, 120) 7px 7px,
    rgb(20, 144, 120) 8px 8px,
    rgb(20, 144, 120) 9px 9px,
    rgb(20, 144, 120) 10px 10px,
    rgb(20, 144, 120) 11px 11px,
    rgb(20, 144, 120) 12px 12px,
    rgb(20, 145, 121) 13px 13px,
    rgb(20, 146, 122) 14px 14px,
    rgb(20, 147, 123) 15px 15px,
    rgb(20, 148, 123) 16px 16px,
    rgb(20, 149, 124) 17px 17px,
    rgb(20, 150, 125) 18px 18px,
    rgb(20, 151, 126) 19px 19px,
    rgb(21, 152, 126) 20px 20px,
    rgb(21, 153, 127) 21px 21px,
    rgb(21, 154, 128) 22px 22px,
    rgb(21, 155, 129) 23px 23px,
    rgb(21, 156, 129) 24px 24px,
    rgb(21, 157, 130) 25px 25px,
    rgb(21, 158, 131) 26px 26px,
    rgb(21, 159, 132) 27px 27px,
    rgb(22, 160, 133) 28px 28px;
    box-shadow: rgb(28, 37, 48) 1px 1px,
    rgb(28, 37, 48) 2px 2px,
    rgb(28, 37, 48) 3px 3px,
    rgb(28, 37, 48) 4px 4px,
    rgb(28, 37, 48) 5px 5px,
    rgb(28, 37, 49) 6px 6px,
    rgb(28, 37, 49) 7px 7px,
    rgb(28, 38, 49) 8px 8px,
    rgb(28, 38, 49) 9px 9px,
    rgb(29, 38, 49) 10px 10px,
    rgb(29, 38, 49) 11px 11px,
    rgb(29, 38, 50) 12px 12px,
    rgb(29, 38, 50) 13px 13px,
    rgb(29, 38, 50) 14px 14px,
    rgb(29, 39, 50) 15px 15px,
    rgb(29, 39, 50) 16px 16px,
    rgb(29, 39, 50) 17px 17px,
    rgb(29, 39, 51) 18px 18px,
    rgb(29, 39, 51) 19px 19px,
    rgb(30, 39, 51) 20px 20px,
    rgb(30, 39, 51) 21px 21px,
    rgb(30, 39, 51) 22px 22px,
    rgb(30, 40, 51) 23px 23px,
    rgb(30, 40, 52) 24px 24px,
    rgb(30, 40, 52) 25px 25px,
    rgb(30, 40, 52) 26px 26px,
    rgb(30, 40, 52) 27px 27px,
    rgb(30, 40, 52) 28px 28px,
    rgb(30, 40, 52) 29px 29px,
    rgb(31, 41, 53) 30px 30px,
    rgb(31, 41, 53) 31px 31px,
    rgb(31, 41, 53) 32px 32px,
    rgb(31, 41, 53) 33px 33px,
    rgb(31, 41, 53) 34px 34px,
    rgb(31, 41, 53) 35px 35px,
    rgb(31, 41, 54) 36px 36px,
    rgb(31, 41, 54) 37px 37px,
    rgb(31, 42, 54) 38px 38px,
    rgb(31, 42, 54) 39px 39px,
    rgb(32, 42, 54) 40px 40px,
    rgb(32, 42, 54) 41px 41px,
    rgb(32, 42, 55) 42px 42px,
    rgb(32, 42, 55) 43px 43px,
    rgb(32, 42, 55) 44px 44px,
    rgb(32, 43, 55) 45px 45px,
    rgb(32, 43, 55) 46px 46px,
    rgb(32, 43, 55) 47px 47px,
    rgb(32, 43, 56) 48px 48px,
    rgb(32, 43, 56) 49px 49px,
    rgb(33, 43, 56) 50px 50px,
    rgb(33, 43, 56) 51px 51px,
    rgb(33, 43, 56) 52px 52px,
    rgb(33, 44, 56) 53px 53px,
    rgb(33, 44, 57) 54px 54px,
    rgb(33, 44, 57) 55px 55px,
    rgb(33, 44, 57) 56px 56px,
    rgb(33, 44, 57) 57px 57px,
    rgb(33, 44, 57) 58px 58px,
    rgb(33, 44, 57) 59px 59px,
    rgb(34, 45, 58) 60px 60px;
    background-color: rgb(22, 160, 133);
    height: 150px;
    width: 150px;
    font-size: 75px;
    line-height: 150px;
    text-align: center;
}

So is there a easier, cleaner and better way to do this without need of any graphic?


Explanation why I won't use any graphics

I love creative, unusual and outstanding animations. So I think, with this long shadows are really beautiful things possible.

I've an animation in my mind, which I really want to realize:
I have a text like "Stackoverflow". I add this text a CSS-transition. When I hover this text, it should display a smooth text-shadow.
The thought in a demo
Easy one. But how's about this long shadow would appear? It would be great. But it's going to be a huge CSS for just this animation. Unreasonable.

So I ask You smart heads out there. You know any easy CSS-Trick, or is there maybe a way to realize this with JavaScript or other librarys? Then I think there are more stunning effects possible than my little thought...

解决方案

Check out this tutorial on how to do that with Sass: http://css-tricks.com/metafizzy-effect-with-sass/

and take a look at this CodePen with the full result: http://codepen.io/hugo/pen/nwivF

Your example above is pretty much the only way to do it with pure CSS, and while it does look pretty crazy - it will let you adjust those text-shadows using transitions and such.

这篇关于如何使CSS新的长阴影趋势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆