CSS
的全稱叫作: Cascading Style Sheets
級聯樣式表的縮寫。html
<style > a{ text-decoration: none; color: black; } /*注意它們是有前後順序的,不然不起效果!!!*/ /*未訪問的連接,和a{}相同而且同時存在時會覆蓋a{}*/ a:link{ color:darkblue; } /*鼠標移動到超連接上時*/ a:hover{ text-decoration: underline; color: darkred; } /*被選定的超連接*/ a:active{ text-decoration: underline; color: yellow; } /*已訪問的超連接*/ a:visited{ color: lightblue; } </style>
是一個空標籤,所以只須要寫屬性便可segmentfault
塊級標籤: Block-level Tags
瀏覽器
內聯標籤:Inline-level Tags
框架
塊標籤之間的距離:svg
若是都同樣:margin: 6px
佈局
計算盒子的尺寸:性能
總結:spa
text-align: center
或code
width: 500px; margin: 30px auto 0 auto
在Google
瀏覽器中須要爲圖片定義高度和寬帶才能在圖片沒有加載成功的時候顯示alt
描述文字。cdn
簡寫的形式比分開寫的性能更高,能簡寫儘可能簡寫。
a
標籤是內聯標籤,不能設置寬和高。height: 28px; display:inline-block;
內聯塊標籤:可讓該標籤擁有內聯標籤同時能夠擁有獨立的寬和高。
line-height: 28px;
設置行高和圖片高度一致,是讓圖片和文字垂直居中
的一個小技巧。