CSS描述了網頁的佈局

1.CSS格式css

CSS 規則由兩個主要的部分構成:選擇器,以及一條或多條聲明;CSS聲明老是以分號(;)結束,聲明組以大括號({})括起來:瀏覽器

.style{color:red;text-align:center;}

2.CSS 註釋:/**/spa

3.CSS 選擇器
HTML元素以id屬性來設置id選擇器,CSS 中 id 選擇器以 "#" 來定義code

#terminal
{
text-align:center;
color:red;
}

class 選擇器在HTML中以class屬性表示, 在 CSS 中,類選擇器以一個點"."號顯示blog

.center {text-align:center;}

指定特定的HTML元素使用classterminal

p {text-align:center;}


4.CSS 建立
插入樣式表的方法有三種:內聯樣式)Inline style > (內部樣式)Internal style sheet >(外部樣式)External style sheet > 瀏覽器默認樣式it

外部樣式表(External style sheet)io

<head>
<link rel="stylesheet" href="../css/box.css">
</head>

內部樣式表(Internal style sheet)class

<head>
<style>
.bigBox{overflow:hidden;left: 0px; right: 0px;width: 100%;}
.LeftBox { float: left;width: 63%; height:98%; margin-top:1%;margin-bottom:1%;margin-left:1%;margin-right:1%;}
.RightBox { float: left;width: 33%; height:98%; margin-top:1%;margin-bottom:1%;margin-left:1%;margin-right:1%;}
.box {
position: relative; 
background: #003; 
border-top: 1px solid #d2d6de;
border-top-color: #383838; 
}
</style>
</head>

內聯樣式(Inline style)float

<div id="full" class="bigBox" style="height:1000px;">
相關文章
相關標籤/搜索