CSS常用屬性和值,CSS常用屬性

來源:互聯網
上載者:User

CSS常用屬性和值,CSS常用屬性

下載高清圖:css常用屬性和值(思維導圖總結)

1.字型

<html><head><title>font</title><style>h1{font-family:times,courter;font-size:150%font-style:italic;font-variant:normal;font-weight:normal;}h2{font-family:serif,times;font-size:1cm;font-style:normal;font-variant:small-caps;font-weight:900;}p{font:oblique small-caps bold 1cm sans-serif;}</style></head><body><h1>this is header one</h1><h2>this is header two</h2><p>this is a paragraph </p></body></html>

運行結果:


2.文本

<html><head><title>text</title><style> h1{letter-spacing:-3px;text-align:right;text-decoration:overline; } h2{letter-spacing:0.5cm;text-align:center;text-decoration:line-through; } p{text-align:left;text-decoration:underline;text-indent:1cm;text-transform:lowercase; } a{/*去掉連結底線*/text-decoration:none;text-indent:0.8cm;text-transform:uppercase; }</style></head><body><h1>this is header one</h1><h2>this is header two</h2><p>this is a paragraph </p><a href="http://www.baidu.com">baidu</a></body></html>

運行結果:


3.背景

由於博主懶的去找背景的素材,所以運行之後,醜的不堪入目,不過重點沒有錯誤嘛,大家關注代碼所對應的效果就好了。

<html><head><title>background</title><style> body{background-color:yellow;background-image:url(a.png);background-repeat:repeat;background-attachment:fixed;} h1{background-color:green;background-image:url(bb.png);background-repeat:repeat-x;background-position:bottom; } h2{background-color:blue; } p{background-image:url(bb.png);background-repeat:no-repeat;height:100px;background-position:center; } a{background:red url(bb.png) no-repeat left center;padding:10px; }b</style></head><body><h1>this is header one</h1><h2>this is header two</h2><p>this is a paragraph </p><a href="http://www.baidu.com">aaaaaaaaaaaaaaaaa</a></body></html>

運行結果:


這張有點,看起來亂七八糟的,但是根據代碼來找效果,也是很快的。很容易搞明白,每一句代碼的意思。url就是自己隨便哦添加的路徑,大家不必在意。

4.邊框(PS:加幾句關於滑鼠指標的代碼)

<html><head><title>border</title><style>div{width:80px;height:25px;border-style:solid dotted;cursor:move;}h1{border-style:solid double dashed inset;border-top-style:solid;border-right-style:double;border-bottom-style:dashed;border-left-style:inset;border-width:1px 2px 3px 4px;/*設定邊框第二種方式:border-top-width:1px;border-right-width:2px;border-bottom-width:3px;border-left-width:4px;*/border-color:red yellow green blue;cursor:wait;}h2{border:3px solid green;/*會覆蓋上面的border設定*/border:1px dashed red;cursor:pointer;}</style></head><body><div>aaaaaa</div><h1>this is header one</h1><h2>this is header two</h2></body></html>

運行結果:


當滑鼠移到三個邊框上時,滑鼠指標會發生相應變化:分別變成移動,等待,還有小手的狀態。具體參考<style>標籤內的代碼。

5.列表

<html><head><title>list</title><style></style></head><body><ul style="list-style-type:none; list-style-image:url(bb.png)"><li>aaaaaaaaaaaaa</li><li>aaaaaaaaaaaaa</li><li>aaaaaaaaaaaaa</li><li>aaaaaaaaaaaaa</li><li>aaaaaaaaaaaaa</li><li>aaaaaaaaaaaaa</li></ul><ol style="list-style-type:upper-roman"><li>aaaaaaaaaaaaa</li><li>aaaaaaaaaaaaa</li><li>aaaaaaaaaaaaa</li><li>aaaaaaaaaaaaa</li><li>aaaaaaaaaaaaa</li><li>aaaaaaaaaaaaa</li></ol></body></html>

運行結果:


中所顯示的兩個列表分別是一個無序列表和一個有序列表。

但是在以後的開發中,我們基本不會使用預設的映像,都是自訂欄表前面的映像。style="list-style-type:none.這句代碼就是將列表前的符號風格設定為空白,然後我們就可以自行添加自己需要的映像了。



李碩

CSDN部落格地址:http://blog.csdn.net/wzqnls


常用的CSS屬性

一、html標籤
<pre>...</pre>文字格式化
<div>......</div>列塊容器
字型大小變化 <font size=?>想輸入的字</font>
字型顏色 <font color="...">想輸入的字</font>
字型變粗 <b>想輸入的字</b>
字型變斜 <i>想輸入的字</i>
字型加底線 <u>想輸入的字</u>
對正中央ㄉ文法 <p align="center">內容</p>
對正左邊ㄉ文法 <p align="left">內容</p>
對正右邊ㄉ文法 <p align="right">內容 </p>
字型刪除線 <s>想輸入的字</s>
字型設定 <font face="字型名稱">想輸入的字</font>
打字機字型 <tt>想輸入的字</tt>
上標字 <sup>想輸入的字</sup>
下標字 <sub>想輸入的字</sub>
水平線 <hr color="...">
換行輸入 想輸入的字<br>想輸入的字
超連結 <a href="想連結網址">連結地的名稱</a>
<a href="mailto:填入email">要顯示的字打這裡</a>網路郵寄標籤
貼圖 <img src="圖形的網址">
跑馬燈(迴圈) <marquee behavior=scroll>想輸入的字</marquee>
外部檔案匯入格式標籤
CSS外部匯入格式:
<link rel="stylesheet" type="text/css" href="/css.css" />
直接引用:
<style type="text/css">
<!--
id{...}
-->
</style>
javascript - 載入外部.js獨立檔案:
<script type="text/javascript" src="/script.js"></script>
二、CSS文字屬性:
color : #999999; /*文字顏色*/
font-family : 宋體,sans-serif; /*文字字型*/
font-size : 9pt; /*文字大小*/
font-style:itelic; /*文字斜體*&#47......餘下全文>>
 
html中CSS常用的的一些屬性有什

下面的是文本常用:
文本對齊屬性(text-align)
文本修飾屬性(text-decoration) 多用於a連結
文本縮排屬性(text-indent)
行高屬性(line-height)
顏色屬性(color)
字型(font)

其他的:
display
position
float
background
......

基本都是要掌握的
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.