Pure也是一款很出色的CSS框架,之前分享的Bootstrap是由Twitter出品的,而Pure是来自雅虎的。尽管从UI界面效果上来说,Pure没有Bootstrap那样精美,但Pure是纯CSS实现的,因此非常小巧,整个框架压缩后只有5.7k左右。
Pure的特点
- 最大的特点就是框架基于纯CSS,无任何JavaScript代码,渲染速度比较快。
- 由Yahoo出品,技术上应该不存在太大问题。
- 框架十分小巧,压缩后仅5.7k。
- 组件也很丰富,包括表格、表单、按钮、表、导航等。
- CSS类的标识十分简单,因此在使用Pure的过程中代码会比较友好。
Pure组件的相关示例及使用方法
首先在页面上引用Pure的CSS库:
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">
在head之间加上以下meta标签,用来控制页面在移动设备上的宽度和高度:
<meta name="viewport" content="width=device-width, initial-scale=1">
表单
Pure实现横向登录表单
HTML代码:
<form class="pure-form"> <fieldset> <legend>A compact inline form</legend> <input type="email" placeholder="Email"> <input type="password" placeholder="Password"> <label for="remember"> <input id="remember" type="checkbox"> Remember me </label> <button type="submit" class="pure-button pure-button-primary">Sign in</button> </fieldset> </form>
Pure实现纵向登录表单
HTML代码:
<form class="pure-form pure-form-stacked"> <fieldset> <legend>A Stacked Form</legend> <label for="email">Email</label> <input id="email" type="email" placeholder="Email"> <label for="password">Password</label> <input id="password" type="password" placeholder="Password"> <label for="state">State</label> <select id="state"> <option>AL</option> <option>CA</option> <option>IL</option> </select> <label for="remember" class="pure-checkbox"> <input id="remember" type="checkbox"> Remember me </label> <button type="submit" class="pure-button pure-button-primary">Sign in</button> </fieldset> </form>
Pure实现多列表单字段的登录表单
HTML代码:
<form class="pure-form pure-form-stacked"> <fieldset> <legend>Legend</legend> <div class="pure-g"> <div class="pure-u-1 pure-u-md-1-3"> <label for="first-name">First Name</label> <input id="first-name" class="pure-u-23-24" type="text"> </div> <div class="pure-u-1 pure-u-md-1-3"> <label for="last-name">Last Name</label> <input id="last-name" class="pure-u-23-24" type="text"> </div> <div class="pure-u-1 pure-u-md-1-3"> <label for="email">E-Mail</label> <input id="email" class="pure-u-23-24" type="email" required> </div> <div class="pure-u-1 pure-u-md-1-3"> <label for="city">City</label> <input id="city" class="pure-u-23-24" type="text"> </div> <div class="pure-u-1 pure-u-md-1-3"> <label for="state">State</label> <select id="state" class="pure-input-1-2"> <option>AL</option> <option>CA</option> <option>IL</option> </select> </div> </div> <label for="terms" class="pure-checkbox"> <input id="terms" type="checkbox"> I've read the terms and conditions </label> <button type="submit" class="pure-button pure-button-primary">Submit</button> </fieldset> </form>
按钮
利用Pure我们实现很多简单的按钮,效果如下:
HTML代码:
<div> <style scoped> .button-success, .button-error, .button-warning, .button-secondary { color: white; border-radius: 4px; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); } .button-success { background: rgb(28, 184, 65); /* this is a green */ } .button-error { background: rgb(202, 60, 60); /* this is a maroon */ } .button-warning { background: rgb(223, 117, 20); /* this is an orange */ } .button-secondary { background: rgb(66, 184, 221); /* this is a light blue */ } </style> <button class="button-success pure-button">Success Button</button> <button class="button-error pure-button">Error Button</button> <button class="button-warning pure-button">Warning Button</button> <button class="button-secondary pure-button">Secondary Button</button> </div>
更多关于Pure的例子和文档,大家可以前往雅虎Pure的官方网站上查找,关于Pure的用法就暂时介绍到这里了。
本文链接:http://www.codeceo.com/article/yahoo-pure-css.html
本文作者:码农网 – 小峰
相关推荐
纯CSS(Pure CSS)是雅虎开发的一个轻量级、模块化的前端框架,专注于提供响应式的样式解决方案,帮助开发者快速构建美观且适应不同设备的网页。这个框架的主要目标是简化跨平台的网页设计,使网站在桌面、平板电脑...
Pure是来自雅虎的CSS框架,使用Normalize.CSS无需任何JavaScript代码。框架基于响应式设计,提供多种样式的组件,包括表格、表单、按钮、表、导航等。标识使用非常简单,整个框架非常轻量级。Pure是一组小型的自适应...
本项目是一个基于前端开发的压缩包,命名为"pure.zip",其中包含了"pure.css"这一轻量级、响应式的CSS框架。Pure.css由雅虎公司开发并维护,旨在为开发者提供一套简洁而实用的样式模块,以帮助快速构建现代Web应用...
Pure 是来自雅虎的 CSS 框架,使用 Normalize.CSS 无需任何 JavaScript 代码。框架基于响应式设计,提供多种样式的组件,包括表格、表单、按钮、表、导航等。标识使用非常简单,整个框架非常轻量级。
纯洁Pure 是一组小型的响应式 CSS 模块,您可以在雅虎开发团队实现的每个 Web 项目中使用它们。 这个 gem 将 Pure CSS 0.5.0 添加到 Rails 3.2 的资产管道中。 此外,它还提供一个 jQuery 函数,可以自动启用下拉...
7. Pure CSS:来自雅虎的Pure CSS是一组模块化的CSS库,易于集成到任何Web项目中。它的设计简洁,易于使用,有助于简化CSS开发过程。 8. KNACSS:KNACSS是一个简约、响应式且可扩展的CSS框架,自动化处理许多基本...
Pure:美国雅虎公司出品的一组轻量级、响应式纯css模块,适用于任何Web项目。 Polymer:Polymer提供了一种为Web应用程序创建自定义元素的简单方法,目的是用来构造Web组件。 knockout.js:是一个基于JavaScript开发...