迅雷看看案例

知识点总结

position三种形式

1.静态定位 position:static; (标准流中的元素默认形式,基本不存在)
2.相对定位 ** position:relative;**(相对于自己定位)
定位坐标:top|bottom|left|right
取值为正:往盒子里走;取值为负,网盒子内走
3.绝对定位 position:absolute;(相对于定位元素)
定位坐标:top|bottom|left|right
4.固定定位 position:fixed;(相当于网页窗口)
问题:在IE6.IE7下不兼容
定位坐标:top|bottom|left|right

z-index

目的:实现盒子的逻辑关系,叠加
作用: z-index:【数字】; 提高层级

CSS精灵----雪碧技术

运用背景图的backfround-position属性
background-position:水平方向坐标 垂直方向坐标;

游标

cursor:pointer; 当鼠标移上时,鼠标变小手

可见性

display:none; 完全隐藏,不占位(还有inline|block|inline-block)
visibility:hidden; 占位隐藏 (或visibility:visible; 占位可见)
overflow:hidden; (溢出隐藏)
或overflow-x:hidden; 水平(淘宝首页在用) overflow-y:hidden; 垂直

列表

控制列表项目编号/符号的属性:list-style
list-style-type|list-style-position|list-style-image

list-style-type:none    取消项目编号/符号   最常用
list-style-type:disc      小圆点            默认
list-style-type:square  小方块 
list-style-type:circle  空心圆 
list-style-position:inside;   项目符号在边框内显示  padding:0;margin:0;
list-style-position:outside;  项目符号在边框内显示 

通常:不用列表的默认项目编号/符号,通常用背景图,配合padding-left
完成前面的小点

迅雷看看案例

Emmet
作用:快速书写HTML和CSS,带你飞
快捷键:ctrl+e或Tab
常用写法
1.html:5 + 快捷键 调出html5基本骨架;
html:xt+ 快捷键 调出xhtml1.0基本骨架
2.简单元素写法:标签名称(+快捷键)

img1.png

3.带类(class)元素的写法:标签名称.类名(+快捷键)
img2.png

4.带id元素的写法:标签名称#id(+快捷键)
img3.png

5.双种属性下并排书写即可
6.兄弟级并列元素写法:兄标签+弟标签(+快捷键)
img4.png

7.父子级嵌套关系的写法:父标签>子标签(+快捷键)
迅雷看看案例_第1张图片
img5.png

8.如果让某个元素重复,可以用*
迅雷看看案例_第2张图片
img6.png

9.如果某个数值是递增的,可以用$配合*使用
迅雷看看案例_第3张图片
img7.png

注:实际开发中,不提倡使用*{margin:0;padding:0;},太耗费资源,很多网站均提供了css初始化的功能,如 Yahoo reset css
写代码过程中的总结

1.vertical-align:top(最顶)|bottom(最底)|sub(下标)|super(上标)|text-top(父元素顶)|text-bottom(父元素底)|baseline(默认。元素放在父元素基线上)|%(使用"line-height"属性的百分比值来排列此元素,可为负)
2.调用css样式表:中添加 href="--/--.css">
3.应用swf动态图片:在对应位置加
4.提取公共类:例:宽度均为800px,在css中用.w800{width:800px;margin:0 auto}其中margin:0 auto;是集中对齐
5.盒子宽度的算法:盒子占空间的宽度 = 盒子内容宽度(width) + 左右padding + 左右border + 左右margin
6 IE6下盒子不能小于13px
如果一个盒子小于了13px,那么就给它加overflow:hidden;
7.不透明度:

标准浏览器下----opacity:0~1;
IE6|IE7|IE8下:fiter:alpha(opacity:0~100);

8.解决在IE6下有双倍边距的问题:把他们转化成行内元素,也就是说
在float:left;或float:right的后面,添加display:inline;

注意:不要给ol和ul加display:inline;

9.如果行内元素右浮动,而且它是最后一个元素,那么它在低版本IE下会在下一行显示
解决方案:1. 将该元素放在第一个的位置;2. 不用浮动,改用绝对定位
10.禁止文字换行:white-space:nowrap;
11.代码:text-align:right;展开的快捷代码:ta:r
代码:text-align:center;展开的快捷代码:ta:c
代码:text-align:left;;展开的快捷代码:ta:l
代码:background-color:;展开的快捷代码:bgc

迅雷看看代码

HTML




    
    迅雷看看
    
    



  







CSS

@charset "utf-8";
/*公共部分*/
.w970{
    width: 970px;
    margin: 0 auto;
}
.w968{
    width: 968px;
    margin:0 auto;
    border: 1px solid #ddd;
}
body{
    font-size: 12px;
    font-family: "宋体";
    color:#aaaaaa;
}
a{
    color:#3d3d3d;
    text-decoration: none;
    font-size: 12px;
}
a:hover{
    text-decoration: underline;
}
/*公共部分结束*/
/*第一部分 start*/
.header{
    height: 108px;
}
.logo{
    width: 290px;
    height: 108px;
}
.logo embed{
    width: 290px;
    height: 108px;
}
.center{
    width: 400px;
    height: 88px;
    padding-top: 20px;
}
.center form{
    width: 394px;
    height: 27px;
    border: 3px solid #eee;
}
.q{
    width: 320px;
    height: 25px;
    line-height: 25px;
    border: 1px solid #babebf;
    border-right: none;/*解决了在IE6.7下的框内字居中问题*/
    font-size:12px;
    outline: none;
    color: #999;
    padding-left: 5px;
    float:left;/*解决了在IE6.7版本下的代码换行问题*/
}
.p{
    width:68px;
    height: 27px;
    background: url(../images1/headerpage_02.png);
    border: 0 none;
    color: white;
    font-size: 14px;
    font-weight: bold;
    outline: none;
    float:left;
}
.center p{
    padding-top: 9px;
}
.center p a{
    font-size: 12px;
    color: #999;
    margin:0 3px;
}
.signed{
    width: 280px;
    height: 68px;
    padding-top: 40px;
    text-align: right;
    line-height: 20px;
    color:#ececec;
}   
.signed a{
    color: #999;
    font-size: 12px;
}
.sub{
    background: url(../images1/dy.png) no-repeat 0 1px;
    padding-left: 15px;
}
/*第二部分 start*/
.nav{
    height: 35px;
    line-height: 35px;
}
.nav li{
    float: left;
    display: inline;
}
.nav a{
    color: #3d3d3d;
}

.main-nav li{
    padding: 0 10px;
}
.main-nav a{
        font-size: 14px;
}
.main-nav a:hover{
    color: #0081cc;
} 
.main-nav.cur a{
    color: #0081cc;
    font-weight: bold;
}

.sub-nav{
    background: url(../images1/subnav_bg.png) no-repeat 0 7px;/*出现问题*/
    margin-left:10px;
}
.sub-nav li{
    padding: 0 11px;
    position:relative;  
}
.sub-nav img{
    position: absolute;
    top: 0px;
    left:44px;
}

.user-nav{
    margin-left: 57px;
    color: #666666;
}
.user-nav li{
    position:relative;
    margin-right:20px;
}
.user-nav s{
    width: 5px;
    height: 3px;
    background:url(../images1/headerpage.png) 0 -64px;
    position:absolute;
    right:-9px;
    top:16px;
    overflow:hidden;
}
/*第二部分 end*/

/*第三部分 主体部分 start*/
.main{
    height: 365px;
    margin-top: 10px;
    background-color: #000000;
    padding:8px 0 7px 0;
}
.banner{
    width: 740px;
    height: 365px;
}
.banner-right{
    width: 230px;
    height: 365px;
    background: pink;
}

.banner div {
    width: 740px;
    height: 310px;
    margin-bottom: 8px;
    position: relative;
}
.banner div a{
    font-size: 14px;
}
.banner div img{
    width: 740px;
    height: 310px;
}
.banner div p{
    width: 740px;
    height: 33px;
    line-height: 33px;
    position:absolute;
    left:0px;
    bottom: 0px;/*错误:把bottom写成right,导致文字始终在图片下方*/
    background-color: #000;
    font-size: 14px;
    color: #fff;
    text-indent:15px;
    opacity: 0.5;
    filter:alpha (opacity:50);
}
.banner ul{
}
.banner ul li{
    width: 56px;
    height: 45px;
    float:left;
    display:inline;
    background: url(../images1/rank.png) -228px -51px;
    cursor: pointer;
    padding:1px;
    margin-right: 4px;
}
.banner ul img{
    width:56px;
    height: 45px;
}
.banner li.cur{
    padding-top: 5px;
    margin-top: -4px;
    background-position: -228px 0px;
}

.banner-right {
    width: 218px;
    height: 353px;
    border: 1px solid #393939;
    background: url(../images1/rank.png);
    font-size: 12px;
    padding: 10px 5px 0;/*顺序:上、左右、下*/

}
.banner-right-nav {
    width: 210px;
    height: 21px;
    border-left: 1px solid #545454;
    border-top: 1px solid #545454;
    margin:0 auto;
}
/*第三部分 主体部分 end*/

你可能感兴趣的:(迅雷看看案例)