
为了让我自己写的动画效果值得称赞,我用一个非常有名的开源的CSS3动画库,被形象的称为animate.css。 Dan Eden写的。
这是让我能专注于手头的任务,而不是解释CSS3动画的代码。
用Animate.css 需要2个步骤:
在html文档中引入animate.min.css。
在网页中要加动画的元素上添加animated yourchosenanimation类。
接下来你用Animate.css网站上的看到的关于动画的类名,代替yourchosenanimation。
引入Bootstrap轮播组件
Bootstrap轮播组件有三个主要的部分。
轮播指示显示幻灯的页面数量,给用户提供一个视觉线索,并提供可以滑动的导航。
轮播条目,一个叫.carousel-inner的类,包含在外边框的里边。代表每一个独立的滑块。每个图片里边的都可以放置图片。也可以添加标题。还可以在html元素上添加carousel-caption类名。Bootstrap会有自带的样式。我们可以通过这些元素添加动画。
最后,是轮播控制箭头,功能是可以使用户前后滑动。
作为 CSS Sprite 使用所有的图标图像都捆绑到一起,并通过 background-position CSS 属性使用。图像文件是 glyphicons-halflings.png,位于 Bootstrap 主文件夹下的 img 文件夹。图标的样式以及背景位置是在 bootstrap.css 的行号 1168 到 1544 中规定。请注意,为避免冲突,所有的图标 class 都以 "icon-" 为前缀。Bootstrap 2.0 中定义了 120 个图标 class。
如何在您自己的站点或 app 中使用图标
下面是在站点或 app 中使用图标的通用语法:
<i class="icon_class_name"></i>
其中 "icon_class_name" 是在 bootstrap.css 中定义的图标 class 的名称(例如:icon-music、icon-star、icon-user 等)。
如果您想要使用白色图标,然后添加一个额外的 icon-white class,如下所示:
<i class="icon_class_name icon-white"></i> </i>
如果您想要在使用图标时带上一些字符串,记得在 之后添加一些空格。在按钮中使用图标或者一些导航链接中可能会出现这种情况。
实例:一个搜索表单
实例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>使用Bootstrap 版本2.0 中搜索图标的实例</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="很多时候,如果你的项目需要的是一个轻量级的轮播,不需要很多的功能。同时你的项目是采用Bootstrap,(一个最流行的开源前端框架)的话。你可以参考一下bootstrap官方组件。介绍Animate.css为了让我自己写的动画效果值得称赞,">
<meta name="author" content="">
<!-- Le styles -->
<link href="../bootstrap/twitter-bootstrap-v2/docs/assets/css/bootstrap.css" rel="stylesheet">
<style type="text/css">
form {
margin-top: 50px
}
</style>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="../bootstrap/twitter-bootstrap-v2/docs/examples/images/favicon.ico">
<link rel="apple-touch-icon" href="../bootstrap/twitter-bootstrap-v2/docs/examples/images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="../bootstrap/twitter-bootstrap-v2/docs/examples/images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="../bootstrap/twitter-bootstrap-v2/docs/examples/images/apple-touch-icon-114x114.png">
</head>
<body>
<div class="container">
<div class="row">
<div class="span12">
<form class="well form-search">
<input type="text" class="input-medium search-query">
<button type="submit" class="btn"><i class="icon-search"></i>搜索</button>
</form>
</div>
</div>
<footer>
<p>© Company 2013</p>
</footer>
</div>
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)