發表文章

目前顯示的是有「CSS」標籤的文章

CSS 依照兄弟元素來調整你的CSS樣式

說明 這是由 André Luís 文章中 提出的。 在這個範例中,允許1~3個相鄰的元素均分整個父元素的寬度。 當然,你也可以透過更改css,來達成不同的樣式,而不只是寬度。 範例 /* 只有一個元素 */ li:nth-child(1):nth-last-child(1) { width: 100%; } /* 兩個元素 */ li:nth-child(1):nth-last-child(2), li:nth-child(2):nth-last-child(1) { width: 50%; } /* 三個元素 */ li:nth-child(1):nth-last-child(3), li:nth-child(2):nth-last-child(2), li:nth-child(3):nth-last-child(1) { width: 33.3333%; } ...

CSS smaill note

圖片
使用方式 放style=""在標籤中 <head> <style> ... </style> </head> <link rel="stylesheet" href="style.css" /> 選標籤的差別 /* 為class為red的標籤設計style*/ .red   { }   /* 為id為red的標籤設計style*/ #red   { }   /* div裡的div裡的div裡的所有h3字都是紅色的。 */ div   div   div   h3   {    color :   red ; }   /* div裡的所有p的字體都是紅色的(包含子標籤)*/ div   p {    color :   red ; } ex : < div > < p > test < / p >   /*此行是紅的*/ < li > < p > test2 < / p >   /*此行是紅的*/ < / li > < / div >     /* div裡的p的字體都是紅色的(不包含子標籤)*/   div > p {    color :   red ; } ex : < div > < p > test < / p >   /*此行是紅的*/ < li > < p > test2 < / p >   /*不是紅的*/ < / li > < / div > 字體 font-family #字型 text-decoration:none; #不要底線  em 與 px 1px 是螢幕上一個像素的大小,1em則是預設字體的大小。 有可能被不同解析度的螢幕讀取的網頁,em顯然是比較好的選擇。  比較不會無法顯示的字體 serif sans-serif cursive #可愛 :pseudo-class_selector a:link #沒去過的li...