美文网首页
相对路径等路径

相对路径等路径

作者: Khada | 来源:发表于2018-07-10 20:14 被阅读0次

相对定位

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>相对定位</title>
<style type="text/css">
.box1{
    height: 200px;
    background-color: red;
    position: relative;
}
.box2{
    width: 200px;
    height: 200px;
    background-color: yellow;
    position: relative;
    left: 100px;
    top: 200px;
}
.box3{
    width: 200px;
    height: 200px;
    background-color: yellowgreen;
}
.s1{
    position: relative;
    width: 200px;
    height: 200px;
    background-color: yellow;
}
</style>
</head>
<body>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
<span class="s1">我是一个span</span>
</body>
</html>

绝对定位

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>绝对定位</title>
<style type="text/css">
.box1{
    width: 200px;
    height: 200px;
    background-color: red;
}
.box2{
    width: 200px;
    height: 200px;
    background-color: yellow;
    position: absolute;
}
.box3{
    width: 300px;
    height: 300px;
    background-color: yellowgreen;
}
.box4{
    width: 300px;
    height: 300px;
    background-color: orange;
}
.s1{
    width: 100px;
    height: 100px;
    background-color: yellow;
    position: absolute;
}
</style>
</head>
<body>
<div class="box1"></div>
<div class="box5">
<div class="box4">
<div class="box2"></div>
</div>
</div>
<div class="box3"></div>

<span class="s1">我是一个span</span>
</body>
</html>

固定定位

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>固定定位</title>
<style type="text/css">
.box1{
    width: 200px;
    height: 200px;
    background-color: red;
}
.box2{
    width: 200px;
    height: 200px;
    background-color: yellow;
    position: fixed;
    left: 0px;
    top: 0px;
}
.box3{
    width: 200px;
    height: 200px;
    background-color: yellowgreen;
}
</style>
</head>
<body style="height: 5000px;">
<div class="box1"></div>

<div class="box4" style="width: 300px; height: 300px; background-color: orange;   position: relative;">
  <div class="box2"></div>
  </div>

<div class="box3"></div>
</body>

开班信息

  <!DOCTYPE html>
  <html lang="en">
  <head>
<meta charset="UTF-8">
<title>开班信息</title>
<style type="text/css">
    /*清除默认样式*/
    *{
        margin: 0;
        padding: 0;
    }
    /*统一页面中的字体*/
    body{
        font: 12px/1 宋体;
    }
    /*设置outer的大小*/
    .outer{
        width: 300px;
        /*height: 473px;*/
        /*background-color: #bfa;*/
        /*设置outer居中效果*/
        margin: 50px auto;
    }
    /*设置title的边框*/
    .title{
        /*设置上边框*/
        border-top: 2px #019e8b solid;
        /*设置盒子的高度*/
        height: 36px;
        /*设置背景样式*/
        background-color: #f5f5f5;
        /*设置title的行高*/
        line-height: 36px;
        /*设置title的内边距*/
        padding: 0px 22px 0px 16px;
    }
    /*设置title中的超链接*/
    .title a{
        float: right;
        /*设置字体颜色*/
        color: red;
    }
    /*设置h3*/
    .title h3{
        font: 16px/36px "微软雅黑";
    }
    /*设置内容*/
    .content{
        border: 1px solid #deddd9;
        /*设置内边距*/
        padding: 0px 28px 0px 20px;
    }
    /*设置内容中的超链接*/
    .content a{
        color: black;
        text-decoration: none;
        /*设置字体大小*/
        font-size: 12px;
    }
    /*为超链接添加一个hover伪类*/
    .content a:hover{
        color: red;
        /*为超链接添加下划线*/
        text-decoration: underline;
    }
    /*设置内容中的标题*/
    .content h3{
        margin-top: 14px;
        margin-bottom: 16px;
    }
    /*设置右侧a的样式*/
    .content .right{
        /*设置向右浮动*/
        float: right;
    }
    /*设置ul的样式*/
    .content ul{
        /*去除项目符号*/
        list-style: none;
        /*为ul设置一个下边框*/
        border-bottom: 1px dashed #deddd9;
    }
    /*取消最后一个ul的边框*/
    .content .no-border{
        border: none;
    }
    /*设置内容中的红色字体*/
    .content .redfont{
        color: red;
        font-weight: bold;
    }
    /*设置内容中的li*/
    .content li{
        margin-bottom: 15px;
    }
</style>
</head>
<body>
<!-- 创建一个外层div,容纳整个内容 -->
<div class="outer">
    <!-- 开班信息的头部 -->
    <div class="title">
        <a href="#">18年面授开班计划</a>
        <h3>近期开班</h3>
    </div>

    <!-- 开班信息的主要内容 -->
    <div class="content">
        <h3><a href="#">人工智能+Python-高薪就业班</a></h3>
        <ul>
            <li>
                <a class="right" href="#"><span class="redfont">预约报名</span></a>
                <a href="#">开班时间:<span class="redfont">2018-04-26</span></a>
            </li>
            <li>
                <a class="right" href="#"><span class="redfont">无座,名额爆满</span></a>
                <a href="#">开班时间:<span class="redfont">2018-03-23</span></a>
            </li>
            <li>
                <a class="right" href="#"><span>开班盛况</span></a>
                <a href="#">开班时间:<span>2018-01-23</span></a>
            </li>
            <li>
                <a class="right" href="#"><span>开班盛况</span></a>
                <a href="#">开班时间:<span>2017-12-20</span></a>
            </li>
            <li>
                <a class="right" href="#"><span>开班盛况</span></a>
                <a href="#">开班时间:<span>2017-11-18</span></a>
            </li>
        </ul>
        <h3><a href="#">Android开发+测试-高薪就业班</a></h3>
        <ul>
            <li>
                <a class="right" href="#"><span class="redfont">预约报名</span></a>
                <a href="#">开班时间:<span class="redfont">2018-04-26</span></a>
            </li>
            <li>
                <a class="right" href="#"><span>开班盛况</span></a>
                <a href="#">开班时间:<span>2018-03-23</span></a>
            </li>
            <li>
                <a class="right" href="#"><span>开班盛况</span></a>
                <a href="#">开班时间:<span>2018-01-23</span></a>
            </li>
            <li>
                <a class="right" href="#"><span>开班盛况</span></a>
                <a href="#">开班时间:<span>2017-12-20</span></a>
            </li>
        </ul>
        <h3><a href="#">大数据软件开发-青芒工作室</a></h3>
        <ul class="no-border">
            <li>
                <a class="right" href="#"><span class="redfont">预约报名</span></a>
                <a href="#">开班时间:<span class="redfont">2018-04-26</span></a>
            </li>
            <li>
                <a class="right" href="#"><span>开班盛况</span></a>
                <a href="#">开班时间:<span>2018-01-23</span></a>
            </li>
        </ul>
    </div>
</div>
</body>
</html>

相关文章

  • 细节知识点记录

    1:相对路径 在前端html页面引用js,css,img等静态资源时,通常使用路径为相对路径。但之前对相对路径的认...

  • 相对路径等路径

    相对定位 绝对定位 固定定位 开班信息

  • Mac OS X系统的路径

    路径分为相对路径和绝对路径 1.相对路径: 不以斜线开头的路径都是相对路径.如codes/Test.m 相对路径都...

  • Go 各种方式加载配置文件

    加载配置文件 相对路径绝对路径网络GET, http ftp等嵌入到应用程序中远程配置中心 1. 相对路径 go ...

  • iOS PCH文件修改路径

    PCH文件修改路径: 绝对路径->相对路径 朋友总结的PCH 设置PCH的相对路径 要想设置PCH的相对路径,首先...

  • PCH的相对路径

    设置PCH的相对路径 要想设置PCH的相对路径,首先我们需要去查看绝对路径。 相对路径 点击PCH文件,Xcode...

  • iOS开发-设置PCH的相对路径

    设置PCH的相对路径 要想设置PCH的相对路径,首先我们需要去查看绝对路径。 相对路径 点击PCH文件,Xcode...

  • html学习第二天

    注释标签: 使用格式: 路径: 路径分为相对路径与绝对路径。 相对路径: 同一级...

  • LINUX命令操作1207

    1、路径:绝对路径和相对路径 绝对路径:以根路径为起点 /home/用户/Document/sysnet 相对路径...

  • iOS 相对路径设置以及cocoapos常见错误

    1.设置相对路径## 要想设置相对路径,必须要查看绝对路径 2.如设置pch的相对路径## 点击pch文件,直接拖...

网友评论

      本文标题:相对路径等路径

      本文链接:https://www.haomeiwen.com/subject/qyvqpftx.html