今天主要學習了製作一個網頁應該如何佈局以及外部樣式的使用方法。
筆記:
<link rel="stylesheet" type="text/css" href="地址"> 引入外部樣式
寫樣式的三種樣式:1.行內樣式 style="屬性:值;"
2.內部樣式 在head內部定義<style></style>
3.外部樣式
引入外部樣式:<link rel="stylesheet" type="text/css" href="地址">
如果樣式後面加上!impotant,則可以達到最高的優先級,打破其他的優先級(有的瀏覽器不支持)
優先級的總結:!important>行內>內部>外部
position relative相對定位 相對於自己位置的變化
absolute絕對定位
實現:(佈局)
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="./css/ce.css">
</head>
<body>
<div id="wai">
<div id="a">
</div>
<div id="b">
</div>
<div id="c">
<div id="d">
<div id="f">
</div>
<div class="e">
</div>
<div class="e">
</div>
<div class="e">
</div>
<div class="e">
</div>
</div>
<div id="e">
<div class="j">
</div>
<div class="j">
</div>
</div>
</div>
<div id="last">
</div>
</div>
</body>
</html>
外部樣式:(ce.css)
#wai{
height: 900px;
width: 1000px;
margin:0 auto;
}
#a{
height: 100px;
width: 1000px;
background-color: red;
}
#b{
height: 240px;
width:1000px;
background-color: black;
}
#c{
height: 700px;
width: 1000px;
background-color: pink;
}
#d{
width: 600px;
height: 700px;
background-color: yellow;
float: left;
}
#f{
width: 600px;
height: 30px;
background-color: blue;
}
.e{
width: 280px;
height: 310px;
margin: 10px;
background-color: green;
float: left;
}
#e{
width: 400px;
height: 700px;
background-color: orange;
float: left;
}
.j{
width: 380px;
height: 335px;
margin: 10px;
background-color: red;
}
#last{
height: 100px;
width: 1000px;
background-color: blue;
}