【HTML5校企公益课】第四天

1、上午考试没去。。

2、下午跟不上。。

变色.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>media</title>
        <style type="text/css">
            body {
                /*取消默认的外间距*/
                margin: 0px;
            }
            main {
                margin: 5px;
                /*对子元素开启弹性布局*/
                display: flex;
                /*换行*/
                flex-wrap: wrap;
            }
            div {
                /*将每个div默认4个一行四列*/
                width: calc((100% - 40px) / 4);
                height: 200px;
                background-color: pink;
                margin: 5px;
            }
            /*媒体查询:检索不同视口宽度*/
            @media (max-1280px) {
                /*在宽度小于等于1280时的样式*/
                div {
                    background-color: #FFFF00;
                }
            }
            
            @media (max-800px) {
                div {
                    background-color: aqua;
                    width: calc((100% - 30px) / 3);        
                }
            }
            
            @media (max-500px) {
                div {
                    background-color: blueviolet;
                    width: calc((100% - 20px) / 2);        
                }
            }
            
            @media (max-350px) {
                div {
                    background-color: chartreuse;
                    width: calc((100% - 10px) / 1);        
                }
            }
        </style>
    </head>
    <body>
        <!--main>div{??}*20-->
        <main>
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
            <div>5</div>
            <div>6</div>
            <div>7</div>
            <div>8</div>
            <div>9</div>
            <div>10</div>
            <div>11</div>
            <div>12</div>
            <div>13</div>
            <div>14</div>
            <div>15</div>
            <div>16</div>
            <div>17</div>
            <div>18</div>
            <div>19</div>
            <div>20</div>
        </main>
    </body>
</html>

后来基本就打酱油了///

下周也不计划去了。。。。

稍微了解了一下html基本结构就好了。。。

网上资源。http://www.w3school.com.cn

没style的:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <header>
            <h1>City Gallery</h1>
        </header>

        <nav>
            London<br>
            Paris<br>
            Tokyo<br>
        </nav>

        <section>
            <h1>London</h1>
            <p>London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.</p>
            <p>Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
        </section>

        <footer>
            Copyright W3School.com.cn
        </footer>
    </body>
</html>

通过添加style就可以变成各种样子:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
header {
background-color:black;
color:white;
text-align:center;
padding:5px;
}

nav {
line-height:30px;
background-color:#eeeeee;
height:300px;
100px;
float:left;
padding:5px;
}

section {
350px;
float:left;
padding:10px;
}
footer {
background-color:black;
color:white;
clear:both;
text-align:center;
padding:5px;
}
</style>
</head>
<body>
<header>
<h1>City Gallery</h1>
</header>

<nav>
London<br>
Paris<br>
Tokyo<br>
</nav>

<section>
<h1>London</h1>
<p>London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.</p>
<p>Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>

<footer>
Copyright W3School.com.cn
</footer>
</body>
</html>

原文地址:https://www.cnblogs.com/xkxf/p/6720877.html