標籤:瀏覽器 注釋 margin 指定 border 樣式 ott order 括弧
1.CSS格式
CSS 規則由兩個主要的部分構成:選取器,以及一條或多條聲明;CSS聲明總是以分號(;)結束,聲明組以大括弧({})括起來:
.style{color:red;text-align:center;}
2.CSS 注釋:/**/
3.CSS 選取器
HTML元素以id屬性來設定id選取器,CSS 中 id 選取器以 "#" 來定義
#terminal{text-align:center;color:red;}
class 選取器在HTML中以class屬性工作表示, 在 CSS 中,類別選取器以一個點"."號顯示
.center {text-align:center;}
指定特定的HTML元素使用class
p {text-align:center;}
4.CSS 建立
插入樣式表的方法有三種:內聯樣式)Inline style > (內部樣式)Internal style sheet >(外部樣式)External style sheet > 瀏覽器預設樣式
外部樣式表(External style sheet)
<head><link rel="stylesheet" href="../css/box.css"></head>
內部樣式表(Internal style sheet)
<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)
<div id="full" class="bigBox" style="height:1000px;">
CSS描述了網頁的布局