永成整形:10个非常有用的CSS技巧 - Web前端 - JavaEye新闻
来源:百度文库 编辑:中财网 时间:2024/05/13 09:06:19
10个非常有用的CSS技巧
声明:JavaEye新闻文章的版权属于JavaEye网站所有,严禁任何网站转载本文,否则必将追究法律责任!
1. 将网页或元素居中
HTML:
CSS:
- .wrap { width:960px; margin:0 auto;}
2.Sticky Footer (让页脚永远停靠在页面底部,而不是根据绝对位置)
HTML:
CSS:
- * { margin:0; padding:0; }
- html, body, #wrap { height: 100%; }
- body > #wrap {height: auto; min-height: 100%;}
- #main { padding-bottom: 150px; } /* must be same height as the footer */
- #footer {
- position: relative;
- margin-top: -150px; /* negative value of footer height */
- height: 150px;
- clear:both;}
- /* CLEAR FIX*/
- .clearfix:after {content: ".";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden;}
- .clearfix {display: inline-block;}
- /* Hides from IE-mac */
- * html .clearfix { height: 1%;}
- .clearfix {display: block;}
- /* End hide from IE-mac */
3.跨浏览器最小高度设置
CSS:
- .element { min-height:600px; height:auto !important; height:600px; }
4.Box阴影(CSS3)
CSS:
- .box { box-shadow: 5px 5px 5px #666; -moz-box-shadow: 5px 5px 5px #666; -webkit-box-shadow: 5px 5px 5px #666; }
5.文字阴影(CSS3)
CSS:
- .text { text-shadow: 1px 1px 1px #666; filter: Shadow(Color=#666666, Direction=135, Strength=5); }
6.跨浏览器的CSS透明度
CSS:
- .transparent {
- /* Modern Browsers */ opacity: 0.7;
- /* IE 8 */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
- /* IE 5-7 */ filter: alpha(opacity=70);
- /* Netscape */ -moz-opacity: 0.7;
- /* Safari 1 */ -khtml-opacity: 0.7;
- }
7.著名的 Meyer Reset(重置)
CSS:
- html, body, div, span, applet, object, iframe,
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
- a, abbr, acronym, address, big, cite, code,
- del, dfn, em, font, img, ins, kbd, q, s, samp,
- small, strike, strong, sub, sup, tt, var,
- dl, dt, dd, ol, ul, li,
- fieldset, form, label, legend,
- table, caption, tbody, tfoot, thead, tr, th, td {
- margin: 0;
- padding: 0;
- border: 0;
- outline: 0;
- font-weight: inherit;
- font-style: inherit;
- font-size: 100%;
- font-family: inherit;
- vertical-align: baseline;
- }
- /* remember to define focus styles! */
- :focus {
- outline: 0;
- }
- body {
- line-height: 1;
- color: black;
- background: white;
- }
- ol, ul {
- list-style: none;
- }
- /* tables still need 'cellspacing="0"' in the markup */
- table {
- border-collapse: separate;
- border-spacing: 0;
- }
- caption, th, td {
- text-align: left;
- font-weight: normal;
- }
- blockquote:before, blockquote:after,
- q:before, q:after {
- content: "";
- }
- blockquote, q {
- quotes: "" "";
- }
8.删除虚线轮廓
CSS:
- a, a:active { outline: none; }
9.圆角
CSS:
- .element {
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px; /* future proofing */
- }
- .element-top-left-corner {
- -moz-border-radius-topleft: 5px;
- -webkit-border-top-left-radius: 5px;
- }
10.覆盖内联的样式
CSS:
- .override {
- font-size: 14px !important;
- }
关于html/css的技巧
使用搜索引擎最有用的3个技巧是什么
谁知道那里有html、css、web服务器的相关知识
谁能告诉我CSS定位的详细技巧
使用搜索引擎最有用的3个技巧是什么,在下面简略说明。
你认为使用搜索引擎最有用的3个技巧是什么,在下面简略说明。
我是个初一的学生为什么我的各科成绩都很好就是数学非常非常糟我改怎么半?就想到全班前10
收集一些非常有用的常识!
哪里有用BT下载的非常娱乐?
谁能提供一些百度空间(CSS)的高级技巧阿~~
重装系统前的注册表导出是否有用
有个非常非常奇怪的问题?
街头篮球后卫的技巧 全一点 有用一点
魔兽中一些有用的快捷键和技巧
听说长期在电脑前工作带个防辐射的眼睛比较啊,这样真的有用吗?
《三国志10》中在攻击较远城市的时候,非常有用的辅助工具是
WEB服务器是个什么样的服务器?
给我个能下载CSS的网址吧
Trojan-Downloader.Win32.small.css是个什么样的病毒
百度空间的CSS怎么弄?请教我个绝招。
请问各位web高手,在百度的自定义css里面,能不能改成点击详细查看后才能看到全文
急求一篇汉译英翻译技巧的文章,非常感谢
世界上最大的前10个城市??????????
求一本非常有用的JAVA电子书