CSS描述了網頁的布局

來源:互聯網
上載者:User

標籤:瀏覽器   注釋   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描述了網頁的布局

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.