瘋狂學習java web2 css

2021-09-06 21:44:58 字數 2443 閱讀 3582

css應該是樣式描述的意思,定義如下:

什麼是 css?

doctype

html

>

<

html

>

<

head

>

<

style

>

body
h1
p
style

>

head

>

<

body

>

<

h1>css example!

h1>

<

p>this is a paragraph.

p>

body

>

html

>

**比較簡單,而且很明顯,css是寫在head部分的,在各種標籤中加以說明,渲染body中各對應標籤的內容.

效果如下:

css 規則由兩個主要的部分構成:選擇器,以及一條或多條宣告:

選擇器通常是您需要改變樣式的 html 元素。

每條宣告由乙個屬性和乙個值組成。

屬性(property)是您希望設定的樣式屬性(style attribute)。每個屬性有乙個值。屬性和值被冒號分開。

css 例項

css宣告總是以分號(;)結束,宣告組以大括號({})括起來:

p 為了讓css可讀性更強,你可以每行只描述乙個屬性:

例項p

id選擇器:

doctype

html

>

<

html

>

<

head

>

<

style

>

#para1
style

>

head

>

<

body

>

="para1"

>hello world!

p>

<

p>this paragraph is not affected by the style.

p>

body

>

html

>

效果如下:

類(class)選擇器:

doctype

html

>

<

html

>

<

head

>

<

style

>

.center
style

>

head

>

<

body

>

<

h1class

="center"

>center-aligned heading

h1>

<

pclass

="center"

>center-aligned paragraph.

p>

body

>

html

>

效果如下:

果然,css這東西看了,對很多東西開始有感覺,原來複雜的就是渲染.

JavaWeb學習筆記 XML 2

dtd約束 對xml檔案進行驗證 1 事例 book.xml 書架 書 書名 書名 作者 作者 售價 售價 書 書架 book.dtd 2 引用 dtd可以在xml檔案內部或寫在.dtd檔案內 引用本地檔案 引用公共檔案 3 語法細節 a 元素定義 b 元素內容 myfile title,autho...

《瘋狂Python》學習第2課

位元組串 bytes 由多個位元組組成,以位元組為單位進行操作。bytes 也是不可變序列。bytes 物件只負責以宇節 二進位制格式 序列來記錄資料,至於這些資料到底表示什麼內容,完全由程式決定。如果希望將乙個字串轉換成bytes 物件,有如下三種方式。1 如果字串內容都是ascii 字元,則可以...

CSS學習筆記(2)

屬性是css非常重要的部分,以下是css屬性 字型屬性 備註 1.font variant 屬性值 all caps 在指定的小體大寫字型不存在的時候,css將用大寫字母代替所有的小寫字母。2.使用font屬性定義 font font style屬性值 font variant屬性值 font we...