CSS3秘笈第三版涵盖HTML5学习笔记9~12章
第9章,装饰网站导航
垂直导航栏
水平导航栏

<ul>
<li><a href="#">one</a></li><li>
<a href="#">two</a></li><li>
<a href="#">three</a></li>
</ul>
效果:

消除空格方法2:对项目列表添加负值的right margin,不过不同的文本长度,会使这个值不同,需要去实验
<style type="text/css">
li {
display: inline-block;
border: 1px solid #999;
margin-right: -9px;
}
</style>
效果:

对水平导航栏使用浮动
CSS式的预载替换法
给特殊的链接类型定义样式
第10章,CSS的transform、transition和animation属性
1、rotate(旋转)
.testClass{
transform:rotate(20deg); /* 提供一个0~360的度数值,正值顺时针方向旋转,负值逆时针 */
}
2、scale(缩放)
.testClass{
transform:scale(2); /* 接受单个参数:放大或缩小,0~1之间的数是缩小,大于1的数是放大,负数会将元素倒过来缩放 */
transform:scale(x,y); /* 接受两个参数:第一个表示水平缩放,第二个表示垂直缩放 */
/*单方向缩放:*/
transform:scaleX(num);/*沿X轴缩放*/
transform:scaleY(num);/*沿Y轴缩放*/
}
3、translate(平移)
4、skew(倾斜)
.testClass{
transform:skew(45deg,0); /* 第一个指沿X轴倾斜(正数向左倾斜<从元素上方沿逆时针进行>,负数向右),*/
/*第二个指沿Y轴倾斜(正数往右边向下<沿顺时针从元素右侧进行>,负数往左边向下),这个理解不够,表达不明白 */
}
.testClass{
transform:skew(45deg,0deg) scale(.5) translate(400px,500px) rotate(90deg);
}
5、origin
transition
1、两个样式,一个开始,一个结束
添加transition
.navButton{
background-color:orange;
transition-property:background-color;
transition-duration:1s;
}
.navButton:hover{
background-color:blue;
}
.testClass{
transition-property:color,background-color,border-color;
transition-duration:.5s,.75s,2s;
}
给transition定时
.testClass{
transition-timing-function:cubic-bezier(.20,.96,.74,.07);
}
延时启动transition
.testClass{
-webkit-transition-delay: .5s;
-moz-transition-delay: .5s;
-o-transition-delay: .5s;
-ms-transition-delay: .5s;
transition-delay: .5s;
}
在初始样式添加:transition-delay: 5s;
transition快捷方法
.testClass{
transition:all 1s ease-in .4s;
}
.testClass{
transition:color 1s,background-color .5s 1s;
}
animation
定义关键帧
@keyframes animationName{
from{
/* list CSS properties here */
}
to{
/* list CSS properties here */
}
}
@keyframes backgroundGlow{
from{
backgorund-color:yellow;
}
50%{
background-color:blue;
}
to{
background-color:red;
}
}
@keyframes glow{
from{
backgorund-color:yellow;
}
25%,75%{
background-color:blue;
}
to{
background-color:red;
}
}
@keyframes glow{
from{
backgorund-color:yellow;
}
20%,60%{
background-color:blue;
}
40%,80%{
background-color:orange;
}
to{
background-color:red;
}
}
@-webkit-keyframes fadeIn{
from{
opacity:;
}
to{
opacity:;
}
}
@-moz-keyframes fadeIn{
from{
opacity:;
}
to{
opacity:;
}
}
@-o-keyframes fadeIn{
from{
opacity:;
}
to{
opacity:;
}
}
@keyframes fadeIn{
from{
opacity:;
}
to{
opacity:;
}
}
应用animation
@keyframes fadeIn{
from{ opacity:; }
to{ opacity:; }
}
2、将动画应用给<div>标签的样式:
.announcement{
animation-name: fadeIn; /*设置动画名称,前面创建的*/
animation-duration: 1s; /* 设置动画从开始到结束所花时间 */
}
给animation定时
@keyframes growAndGlow{
from{
background-color: yellow;
animation-timing-function: cubic-bezier(1, .3, 1, .115);
}
50%{
transform:scale(1.5);
background-color:blue;
animation-timing-function: linear;
}
to{
transform:scale(3);
background-color: red;
}
}
完成animation
使用animation快捷方式
.fade{
animation-name: fadeOut;
animation-duration: 2s;
animation-timing-function: ease-in-out;
animation-iteration-count:;
animation-direction: alternate;
animation-delay: 5s;
animation-fill-mode: forwards;
}
改写:
.fade{
animation : fadeOut 2s ease-in-out 2 alternate 5s forwards;
}
只有名称和持续时间是必要的,其他都是可选,应用多个动画,只需每个动画用逗号隔开即可。
.fade{
animation : fadeOut 2s ease-in-out 2 alternate 5s forwards,
glow 5s;
}
实际应用还需给定供应商前缀:
.fade{
-webkit-animation : fadeOut 2s ease-in-out 2 alternate 5s forwards,
glow 5s;
-moz-animation : fadeOut 2s ease-in-out 2 alternate 5s forwards,
glow 5s;
-o-animation : fadeOut 2s ease-in-out 2 alternate 5s forwards,
glow 5s;
animation : fadeOut 2s ease-in-out 2 alternate 5s forwards,
glow 5s;
}
暂停animation
第11章,表格和表单格式化
创建边框
控制表格单元之间的空格
消除双边框
圆角
table{
empty-cells:hide;
}
给表单定义样式
第三部分----CSS页面布局
第12章,CSS布局简介
网页布局类型
HTML5的分区元素
CSS布局方法
布局策略
CSS3秘笈第三版涵盖HTML5学习笔记9~12章的更多相关文章
- CSS3秘笈第三版涵盖HTML5学习笔记1~5章
第一部分----CSS基础知识 第1章,CSS需要的HTML HTML越简单,对搜索引擎越友好 div是块级元素,span是行内元素 <section>标签包含一组相关的内容,就像一本书中 ...
- CSS3秘笈第三版涵盖HTML5学习笔记6~8章
第二部分----CSS实用技术 第6章,文本格式化 指定备用字体: font-family:Arial,Helvetica,sans-serif; 当访问者没有安装第一种字体时,浏览器会在列表中继续往 ...
- CSS3秘笈第三版涵盖HTML5学习笔记13~17章
第13章,构建基于浮动的布局 使用的是float(浮动)属性 注:float:none值将取消所有浮动,通常只用来取消元素中已经应用的浮动. 切记:不需要给正文的div设计宽度,即使设计成固定宽度也不 ...
- 《Python基础教程(第二版)》学习笔记 -> 第十一章 文件和素材
打开文件 open函数用来打开文件,语句如下: open(name[,mode[,buffering]]) open函数使用一个文件名作为唯一的强制参数,然后后返回一个文件对象.模式(mode)和缓冲 ...
- 《Python基础教程(第二版)》学习笔记 -> 第七章 更加抽象
对象的魔力 多态:意味着可以对不同类的对象使用同样的操作: 封装:对外部世界隐藏对象的工作细节: 继承:以普通的类为基础建立专门的类对象 多态① 多态和方法绑定到对象特性上面的函数称为方法(metho ...
- 《Python基础教程(第二版)》学习笔记 -> 第六章 抽象
抽象和结构 本章将会介绍如何让将语句组织成函数,还会详细介绍参数(parameter)和作用域(scope)的概念,以及递归的概念及其在程序中的用途. 创建函数 函数可以调用,它执行某种行为,并返回某 ...
- 《Python基础教程(第二版)》学习笔记 -> 第五章 条件、循环 和 其他语句
条件和条件语句 下面的值在作为布尔表达式的时候,会被解释器看作假(False):False None 0 "" () [] {} 条件执行和if语句 ...
- 《Python基础教程(第二版)》学习笔记 -> 第四章 字典
字典是Python中唯一内建的映射类型. 字典中的值并没有特殊的顺序,但是都存储在一个特定的键(Key)里.键可以是数字.字符串甚至是元组. 字典的使用 某些情况下,字典比列表更加适用: 表征游戏棋盘 ...
- 《数据库技术基础与应用(第2版)》学习笔记——第7章~
从这章开始,操作的内容开始增多,概念的东西越来越少,可能跟学校的教学目的有关,但是跟我的学习目的不匹配,就不再继续整理. 总结:这本书适合大学本科生学习和了解数据库的相关知识以及Access和SQL ...
随机推荐
- 单片机C语言下LCD多级菜单的一种实现方法
摘要: 介绍了在C 语言环境下,在LCD 液晶显示屏上实现多级嵌套菜单的一种简便方法,提出了一个结构紧凑.实用的程序模型. 关键词: 液晶显示屏; 多级菜单; 单片机; C 语言; LCD 中 ...
- BestCoder Round #65 hdu5591(尼姆博弈)
ZYB's Game Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total ...
- UVA 11354 Bond(MST + LCA)
n<=50000, m<=100000的无向图,对于Q<=50000个询问,每次求q->p的瓶颈路. 其实求瓶颈路数组maxcost[u][v]有用邻接矩阵prim的方法.但是 ...
- 浅析网站开发中的 meta 标签的作用
*:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important; } /* ...
- AxWindowsMediaPlayer创建、添加播放列表(C#)
// 创见打开对话框对象实例 OpenFileDialog openFileDialog = new OpenFileDialog(); //设置为可以打开多个文件 ...
- MVC神韵---你想在哪解脱!(十四)
修正票价字段的精度 前面我们追加数据的时候遗留下来一个问题,就是在追加数据的时候,票价(Price)字段中输入的是9.99元,但是电影清单显示画面中该数据的票价字段显示为10元,这是为什么?这个问题发 ...
- get_template_part() 函数详解备忘(转)
最近研究官方主题 Twenty Eleven ,有一些东西网上现成的中文资料不好找,在博客里记载下来,算是分享,也算是备忘,wordpress 3.0 以后就开始便有了get_template_par ...
- C#文件后缀名详解
C#文件后缀名详解 .sln:解决方案文件,为解决方案资源管理器提供显示管理文件的图形接口所需的信息. .csproj:项目文件,创建应用程序所需的引用.数据连接.文件夹和文件的信息. .aspx:W ...
- 项目经验之:GIS的初步工作窗体的搭建
不多说了,上图,初步工作刚好完 GIS平台系统,实现整个供水系统的协调与统一.系统以管网为基础依据,建立可实现供水管网规划设计.输配管理.图档管理.抢修辅助决策及综合查询.统计等功能. 整体窗口设计 ...
- PostgreSQL的 initdb 源代码分析之一
开始第一段: int main(int argc, char *argv[]) { /* * options with no short version return a low integer, t ...