CSS+DIV 初学者经验

来源:互联网 发布:数据图形 软件 编辑:程序博客网 时间:2024/05/02 16:31

以下都是在自己学习 自适应 及响应适  期间总结的经验


1。针对Body一般在写网页是要设置的样式

body {    margin:0;    padding:0;    width:100%;    height:100%;}

2。img 标签需要设置的属性

img {    border:0;/*去掉边框。当给图片加链接A标签是这一点尤为重要*/    max-width:100%;/*图片的最大尺寸*/    height:auto;/*图片高度为自适应,不给设定固定值,当图片宽度随浏览器大小变化时,图片高度会等比例缩放 */    float:left;/*去掉图片之间间隙*/}

3。div标签

div{    width:100%;    max-width:612px;/*设定一个最大宽度*/    margin:0 auto;/*上下:0;左右:自动*/}
4。去掉div之间的浮动

.clear{    clear:both;}

5。去掉A标签链接修饰

a:link { text-decoration: none;color: #fff;}a:active { text-decoration:none}a:hover { text-decoration:none;color: <span style="font-family: Arial, Helvetica, sans-serif;">#fff; }</span>a:visited { text-decoration: none;color: #fff;}

6。关于UL、 Li的使用,一般需要设定的样式

ul{list-style: none;margin: 0;padding: 0;}li{margin: 0;padding: 0;float: left;width: 33.33333%;/*设定li百分比*/}




0 0
原创粉丝点击