Blogger Information
Blog 12
fans 0
comment 0
visits 10518
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
元素单位px,em.rem介绍
A骆长林的博客
Original
827 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>元素单位px,em.rem的介绍</title>
    <style type="text/css">
        .px{/*px,相对于屏幕*//*后面有line-height(行高),此处可选*/
            width: 100px;
            height:100px;
            background-color:red;
            text-align: center;
            margin: 1px auto;
        }
        .em{ /*em,相对于当前元素或父元素文本大小*/
            font-size:16px;
            width: 6.25em;
            height:6.25em;
            background-color:#FFD534;
            text-align: center;
            margin: 1px auto;
        }
        .rem{ /*em,相对于根html元素文本大小*/
            width:6.25rem;
            height:6.25rem;
            background-color:#2A98FF;
            text-align: center;
            margin: 1px auto;
        }
    </style>
</head>
<body>
<div class="px">这个是px</div>
<div class="em">这个是em</div>
<div class="rem">这个是rem</div>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

IMG_2585.JPG

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments