LESS Hat简单教程

42 篇文章 0 订阅
31 篇文章 0 订阅

今天给大家推荐LESS的几个Mixin集,其中最著名的要数LESS Hat了,诚如其官方网站所言,“86个智能Mixin可以大大简化网页开发工作”。


另外,LESS ElementsTwitter BootstrapPreboot几个也不错,都是可以选择的。



笔者认为,LESS Hat提供的mixin最多,支持最广泛,建议大家使用。大家也可以参阅老外写的《Battle of the LESS Mixin Libraries》,比较几个库的使用。

使用LESS Hat时,只需要将LESS Hat 的less文件导入到网页,然后就可以享受便利了,代码如下

<link rel="stylesheet/less" href="less/lesshat.less" />

Less Hat拥有86个Mixins,详列如下

//  * =========================================================== * 
//  <                            LESSHat                          > 
//  * =========================================================== * 
//
// Made with Energy drinks in Prague, Czech Republic.
// Handcrafted by Petr Brzek, lesshat.com
// Works great with CSS Hat csshat.com

// version: v2.0.15 (2014-01-31)

// TABLE OF MIXINS:
	// align-content
	// align-items
	// align-self
	// animation
	// animation-delay
	// animation-direction
	// animation-duration
	// animation-fill-mode
	// animation-iteration-count
	// animation-name
	// animation-play-state
	// animation-timing-function
	// appearance
	// backface-visibility
	// background-clip
	// background-image
	// background-origin
	// background-size
	// blur
	// border-bottom-left-radius
	// border-bottom-right-radius
	// border-image
	// border-radius
	// border-top-left-radius
	// border-top-right-radius
	// box-shadow
	// box-sizing
	// brightness
	// calc
	// column-count
	// column-gap
	// column-rule
	// column-width
	// columns
	// contrast
	// display
	// drop-shadow
	// filter
	// flex
	// flex-basis
	// flex-direction
	// flex-grow
	// flex-shrink
	// flex-wrap
	// font-face
	// grayscale
	// hue-rotate
	// hyphens
	// invert
	// justify-content
	// keyframes
	// opacity
	// order
	// perspective
	// perspective-origin
	// placeholder
	// rotate
	// rotate3d
	// rotateX
	// rotateY
	// rotateZ
	// saturate
	// scale
	// scale3d
	// scaleX
	// scaleY
	// scaleZ
	// selection
	// sepia
	// size
	// skew
	// skewX
	// skewY
	// transform
	// transform-origin
	// transform-style
	// transition
	// transition-delay
	// transition-duration
	// transition-property
	// transition-timing-function
	// translate
	// translate3d
	// translateX
	// translateY
	// translateZ
	// user-select
为了让大家体会LESS Hat的便利,举个例子吧。我们给div做个动画

div {
 -webkit-animation: nameAnimation 2s linear alternate;
 -moz-animation: nameAnimation 2s linear alternate;
 -opera-animation: nameAnimation 2s linear alternate;
 animation: nameAnimation 2s linear alternate;
}
而在LESS Hat的帮助下,我们只需这样写就行了

div {
 .animation(nameAnimation 2s linear alternate);
}

大家可以到官方帮助文档获取更多使用帮助。That's all. Thank you.

另外,打个广告,大家可以看看我在codepen里的一个案例

---------------------------------------------------------------
前端开发whqet,关注web前端开发技术,分享网页相关资源。
---------------------------------------------------------------

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值