前端(CSS语言-实例)

一、圆形图像处理

  
示例:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div {
            width: 100px;
            height: 100px;
            border: 1px solid red;
            overflow: hidden;          /*隐藏溢出属性*/
            border-radius: 50%;        /*设置边框属性*/
        }
        img {
            max-width: 100%;           /*将图片的大小设置为父级标签的大小*/
        }
    </style>
</head>
<body>

<div>
    <img src="2.jpg" alt="">
</div>

</body>
</html>
View Code

二、position标签定位

  
示例:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .c1, .c2, .c3 {
            height: 1000px;
        }
        .c1 {
            background-color: pink;
        }
        .c2 {
            background-color: deepskyblue;
        }
        .c3 {
            background-color: darkolivegreen;
        }
        .c4 {
            width: 100px;
            height: 50px;
            background-color: black;
            position: fixed;
            left: 40px;
            bottom: 40px;
            text-align: center;
            line-height: 50px;
            border-radius: 50%;
        }
        .c4 a {
            color: white;
            text-decoration: none;
        }
    </style>
</head>
<body>

<span id="top">顶部</span>          <!--设置顶部标签-->

<div class="c1"></div>
<div class="c2"></div>
<div class="c3"></div>

<div class="c4">
    <a href="#top">回到顶部</a>
</div>

</body>
</html>
View Code

三、模态对话框

  
示例:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .c1 {
            top: 0;
            right: 0;
            left: 0;
            bottom: 0;
            background-color: rgba(255,96,90,0.3);
            position: fixed;
            z-index: 100;
        }
        .c2 {
            width: 300px;
            height: 200px;
            background-color: white;
            position: fixed;
            z-index: 101;
            top: 50%;
            left: 50%;
            margin-left: -150px;
            margin-top: -100px;

        }

    </style>
</head>
<body>


<div class="c1"></div>
<div class="c2">
    <form action="">
    用户名:<input type="text"><br>
    密码:&nbsp;&nbsp;&nbsp;<input type="password"><br>
    <input type="submit">
    </form>
</div>


</body>
</html>
View Code

 

posted @ 2019-05-04 11:51  Amorphous  阅读(264)  评论(0编辑  收藏  举报