常见问题2:html+css效果综合整理
1、---文本框提示文字颜色--placeholder属性
<input type="text" placeholder="请输入提示文字" />
::-webkit-input-placeholder { color:#666; }
::-moz-placeholder { color:#666; } /* firefox 19+ */
:-ms-input-placeholder { color:#666; } /* ie */
input:-moz-placeholder { color:#666; }
扩展参考链接:http://www.html5tricks.com/html5-input-css.html
2、圆角,文字阴影,盒子阴影
input,select,textarea{
border-radius:3px;
-webkit-border-radius:3px;
-moz-border-radius:3px;
text-shadow: 0 1px 1px rgba(0,0,0,.3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .5em;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
3、button按钮
display: inline-block;
outline: none; /*框设置无*/
cursor: pointer; /*鼠标经过时手形*/
text-align: center; /*文字居中*/
text-decoration: none; /*无下划线*/
4、a标签
a,a:hover,a:focus{text-decoration:none}
a:link{/*未访问*/}
a:visited {/*已访问*/}
a:hover {/*悬浮*/}
a:active {/*活动链接*/}
5、ul,li设置无样式(去原点等前缀)
ul, li { list-style:none;}
6、超出隐藏加省略号...
div{overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
7、超出隐藏加滚动
max-height: 320px;
overflow: auto;
overflow-x: hidden;
8、透明度
filter:alpha(Opacity=80);-moz-opacity:0.8;opacity: 0.8;
9、图片在DIV中垂直居中
.div{width: 80px; height: 80px;
display:table-cell;/* for opera */
text-align:center;
vertical-align:middle;/* for opera */
}
img{width: 70px;display:inline-block;text-align: center;vertical-align:middle;}
10、控制img图片宽度和高度
img{
max-width:265px;
_width:expression(this.width > 265 ? "265px" : this.width);
max-heigth:180px;
_height:expression(this.height > 180 ? "180px" : this.height);
}
11、鼠标移动到div或元素上的效果
.ztys:hover{background:#01c4d9;color:#fff;}
.ztys:hover img{opacity:;}
.ztys:hover a{background:#fe7669;}
.ztys:hover p,.ztys:hover a,.ztys:hover h2{color:#fff;}
12、透明度
filter:alpha(opacity=80); /**/
opacity:0.8;
13、倾斜30度
-webkit-transform: skew(-30deg);
-moz-transform: skew(-30deg);
-o-transform: skew(-30deg);
transform: skew(-30deg);
14、清除浮动
(1) overflow + zoom方法
.fix{overflow:hidden; zoom:;} 优点:此方法优点在于代码简洁,涵盖所有浏览器
缺点:overflow:hidden;里面的元素 要是有margin负值定位或是负的绝对定位,就会直接被裁掉,所以此方法是有不小的局限性。 (2) after + zoom方法
after:就是指标签的最后一个子元素的后面。
可以用CSS代码生成一个具有clear属性的元素,其中的 关键样式就是content。content里面的内容是”.”一个点,随便写什么东西都没有问题,比如 content:'clear both';或是content:'亿'
.clr{zoom:;}
.clr:after{display:block; content:'clear'; clear:both; line-height:; visibility:hidden;} line-height:0写成height:0也是可以。这个样式清除浮动的,不会影响任何其他样式,通用性强,覆盖面广。
15、背景定位
.mainNav li a.on{ background:transparent url(/ou/index2011.png) no-repeat right -131px;}
.mainNav li a.on span{ background:transparent url(/ou/index2011.png) no-repeat -683px -162px; color:#333;}
16、导航ul li样式中如何去掉最后一个li背景或样式
方法一:直接写行间样式
<li style="background:none;">联系我们</li>
方法二:CSS3方法设置,此方法对IE6无效。
li:last-child{background:none;}
17、<iframe> 和 </iframe>
所有浏览器都支持 <iframe> 标签。
<iframe src ="/index.html" width="100%" height="90%" frameborder="0">
<p>Your browser does not support iframes.</p>
</iframe>
18、table 间隔、合并单元格
单元格边距(表格填充)(cellpadding) -- 代表单元格外面的一个距离,用于隔开单元格与单元格空间
单元格间距(表格间距)(cellspacing) -- 代表表格边框与单元格补白的距离,也是单元格补白之间的距离
colspan属性用在td标签中,用来指定单元格横向跨越的列数:colspan是“column span(跨列)”的缩写。
rowspan的作用是指定单元格纵向跨越的行数。
<table class="m_tb" border=0 cellpadding="0" cellspacing="0">
<tr>
<td ></td>
</tr>
</table>
19、三角效果
.sanjiao{
/* 设定div大小 */
width:;
height:;
/* 防溢出,稳固兼容性 */
overflow:hidden;
/* 箭头尺寸 */
border-width:10px;
/* 给箭头着色,四个值分别是边框的四个方向,箭头的方向正好相反 */
border-color:blue transparent transparent transparent;
/* 为了兼容性,最好把四个值都补上,需要的方向设实线,其他方向虚线 */
border-style:solid dashed dashed dashed;
}
常见问题2:html+css效果综合整理的更多相关文章
- [转载] 高大上的 CSS 效果:Shape Blobbing
这篇大部分是转载,来自<高大上的 CSS 效果:Shape Blobbing>和 <Shape Blobbing in CSS> 有部分是自己理解和整理,配合效果要做出 app ...
- CSS样式命名整理(非原创)
非原创,具体出自哪里忘了,如果侵害您的利益,请联系我. CSS样式命名整理 页面结构 容器: container/wrap 整体宽度:wrapper 页头:header 内容:content 页面主体 ...
- CSS样式命名整理
CSS样式命名整理 页面结构 容器: container/wrap 整体宽度:wrapper 页头:header 内容:content 页面主体:main 页尾:footer 导航:nav 侧栏:si ...
- css命名规范—CSS样式命名整理
CSS样式命名整理 页面结构 容器: container/wrap整体宽度:wrapper页头:header内容:content页面主体:main页尾:footer导航:nav侧栏:sidebar栏目 ...
- css3网格效果(整理)
css3网格效果(整理) 一.总结 一句话总结: css3网格原理是渐变(linear-gradient)绘制图形,background-size属性指定重复的小单元的大小 多个渐变(linear-g ...
- HTML&&CSS基础知识点整理
HTML&&CSS基础知识点整理 一.WEB标准:一系列标准的集合 1. 结构(Structure):html 语言:XHTML[可扩展超文本标识语言]和XML[可扩展标记语言] 2. ...
- 《基于JQuery和CSS的特效整理》系列分享专栏
<基于JQuery和CSS的特效整理>已整理成PDF文档,点击可直接下载至本地查阅https://www.webfalse.com/read/201724.html 文章 一款基于jQue ...
- CSS小tip整理
CSS小tip整理 1.利用css在列表靠头和末尾添加箭头: /* 左箭头*/ ol a[rel="prev"]:before { content: "\00AB&quo ...
- CSS 效果汇总
只要决心够, 就能征服痛苦. 把一些常用的 CSS 效果记录下来 1. 利用 z-index :hover 显示层 github 效果地址>> 此效果主要利用 a:hover 来改变 sp ...
随机推荐
- python全栈开发day76-博客主页
一.昨日内容 1. 注册 1. form组件 - 基于正则的校验规则(手机号和邮箱) - 基于全局钩子判断两次密码是否一致 2. $.each(遍历的对象, function(){ this --&g ...
- 分布式系统的BASE理论
一.BASE理论 eBay的架构师Dan Pritchett源于对大规模分布式系统的实践总结,在ACM上发表文章提出BASE理论,BASE理论是对CAP理论的延伸,核心思想是即使无法做到强一致性(St ...
- 如何查找物理cpu,cpu核心和逻辑cpu的数量
环境 Red Hat Enterprise Linux 4 Red Hat Enterprise Linux 5 Red Hat Enterprise Linux 6 Red Hat Enterpri ...
- Mysql8远程不能登录报错
mysql8远程登录报错Client does not support authentication protocol requested by server; consider upgrading ...
- Codeforces 830C Bamboo Partition 其他
原文链接https://www.cnblogs.com/zhouzhendong/p/CF830C.html 题解 把问题转化成求最大的 $d$ ,满足$$\sum_{1\leq i \leq n}( ...
- RPG
有排成一行的n个方格,用红(Red).粉(Pink).绿(Green)三色涂每个格子,每格涂一色,要求任何相邻的方格不能同色,且首尾两格也不同色.求全部的满足要求的涂法.以上就是著名的RPG难题. 解 ...
- Java集合及LIst接口
一.集合的概念 1.概述: 在学习集合前,先回忆一下数组的一个特征---数组有固定的长度,定义一个数组: int[] array = new int[]; 而针对数据长度可变的情况,产生了集合, ja ...
- 589. N叉树的前序遍历
[题目] 给定一个 N 叉树,返回其节点值的前序遍历. 例如,给定一个 3叉树 : 返回其前序遍历: [1,3,5,6,2,4]. [解析] """ # Definiti ...
- Java代码混淆工具ProGuard
目录 Java代码混淆工具ProGuard 简介 描述 作用的环境 功能 工作原理 下载 使用时注意事项 版本问题 JDK位数问题 Java的字节码验证问题 关于使用类似于Hibernate的对象关系 ...
- shell delete with line number
If you want to delete lines 5 through 10 and 12: sed -e '5,10d;12d' file This will print the results ...