DAY7:引入外部样式;浮动清除浮动,图像和文字在一行;导航栏

* {
    padding: 0;
    margin: 0;
    list-style: none;
}

ul,
ol,
dl {
    padding: 0;
    margin: 0;
}

li {
    list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: normal;
    font-size: 16px;
}

i,
em {
    font-style: normal;
}

b,
strong {
    font-weight: normal;
}

a {
    text-decoration: none;
    color: #000;
}

.clearfix:after {
    display: block;
    content: '';
    clear: both;
}

.fl {
    float: left;
}

.fr {
    float: right;
}

.clearfix {
    zoom: 1;
}
————————————————————————————————————————————————————————————————————————————————base.css
div {
    width: 20px;
    height: 20px;
    background: red;
}

h1 {
    color: pink;
}

ul li {
    width: 100px;
    height: 100px;
    background: red;
    float: left;
}
————————————————————————————————————————————————————————————————————————index.css
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>引入外部样式0316</title>
    <link rel="stylesheet" href="../css/base.css">
    <link rel="stylesheet" href="../css/index.css">
</head>

<body>
    <h1>tangyuan</h1>
    <div></div>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
    </ul>
</body>

</html>
__________________________________________________________________________________
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>清除浮动</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            list-style: none;
        }

        ul {
            border: 1px solid red;
        }

        ul li {
            width: 200px;
            height: 200px;
            background: pink;
            float: left;
        }

        .clearfix::after {
            content: '';
            display: block;
            clear: both;
        }
    </style>
</head>

<body>
    <ul class="clearfix">
        <li>1</li>
        <li>2</li>
        <li>3</li>
    </ul>
</body>

</html>
____________________________________________________________________________________
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图片和文字在一块0316</title>
    <link rel="stylesheet" href="../css/base.css">
    <style>
        div {
            width: 100px;
            height: 30px;
            border: 1px red solid;
            margin: 100px auto;
            /* 文字居中 */
            line-height: 30px;
            /* 图片作为背景 */


            background: url(../img/2.jpg) no-repeat 3px center;
            background-size: 25%;
            /* 背景大小 ,这句话在背景的下面,否则按顺序就会被覆盖;
            背景距左侧有一定距离不用left center,像素和方位一起来确定定位;*/
            padding-left: 35px;
            /* 有内边距防止撑开 */
            box-sizing: border-box;
        }
    </style>
</head>

<body>
    <div class="qq">qq登录</div>
</body>

</html>
___________________________________________________________________________________
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>导航栏浮动</title>
    <link rel="stylesheet" href="../css/base.css">
    <style>
        ul {
            background: pink;
            margin: 0 auto;
            width: 967px;
        }

        li {
            border-right: 1px solid red;
            height: 30px;
            line-height: 30px;
            width: 120px;
            text-align: center;
        }

        ul li:last-child {
            border-right: 0;
        }
    </style>
</head>

<body>
    <ul class="clearfix">
        <li class="fl">1tangyuan</li>
        <li class="fl">2tangyuan</li>
        <li class="fl">3tangyuan</li>
        <li class="fl">4tangyuan</li>
        <li class="fl">5tangyuan</li>
        <li class="fl">6tangyuan</li>
        <li class="fl">7tangyuan</li>
        <li class="fl">8tangyuan</li>
    </ul>
</body>

</html>

你可能感兴趣的:(DAY7:引入外部样式;浮动清除浮动,图像和文字在一行;导航栏)