JavaScript--html标签注意事项回顾大总结

1.height:auto和height:100%的区别?
auto是自适应,是随内容的高度而撑开的。100%是根据父级元素的高度来决定的

<div style="height:auto;width:100px;float:left;">
这个容器的高度是随里面的内容的高度而定</div>

<div style="height:100%;width:100px;float:right;">
这个容器的高度为父级的高度,100px</div> </div>


2.css中元素的auto属性值是什么意思,比如margin:0 auto表示什么?
auto 你可以理解为一种 自动/自适应 的概念 比如 现在项目需要一个宽度为960px的整体布局居中 
根据用户浏览器大小不同你将需要使用margin:0 auto;来实现。无论用户浏览器宽度为多少

margin:0 auto,意思就是上下边距为0,左右边距为auto,就是自动适应。
但是,如果要使用他的话,就必须给标签配上指定的宽度


3.设置字体
font:60px/60px "simhei";
的意思是字体大小为60 行高60 字体为黑体


4.no-repeat
background: yellow url("img/3.jpg") no-repeat
css中no-repeat一般用在元素backgroud-repeat的设置中,含义为不平铺;


5.overflow hidden
<!DOCTYPE html>  
<html>  
<head>  
    <title>父元素中有overflow:hidden, 子元素absolute不能显示</title>  
    <style>  
        .parent{  
            height:40px;  
            width:200px;  
            border:solid 1px black;  
            position:relative;  
        }  
        .sub{  
            position:absolute;  
            top:10px;  
            left:10px;  
            height:100px;  
            width:100px;  
            background-color:red  
        }  

        .overHidden{  
            overflow:hidden;    /* 同样会隐藏position:absolute的子元素 */  
        }  
    </style>  
</head>  
<body>  
这个是有overflow:hidden  
    <div class="parent overHidden">  
        <div class="sub"></div>  
    </div>  
    这个没有  
    <div class="parent">  
        <div class="sub"></div>  
    </div>  
</body>  
</html>  

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值