CSS 改變選取文字的顏色(CSS3 - 目前 Firefox/Safari only)

選取文字的顏色, 想要做修改, CSS3 有規範修改的方法.

下述範例轉載自: Overriding The Default Text Selection Color With CSS

語法:

::selection {
    background: #ffb7b7; /* Safari */
}
::-moz-selection {
    background: #ffb7b7; /* Firefox */
}

Example:

p.red::selection {
    background: #ffb7b7;
}
p.red::-moz-selection {
    background: #ffb7b7;
}

這種設定可以玩什麼, 可見: Text + Image + CSS3 = Crazy Delicious (此網站和上述語法在 IE 無法顯示效果)



更多推薦文章

This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

About Tsung

對新奇的事物都很有興趣, 喜歡簡單的東西, 過簡單的生活.
This entry was posted in News-Technology. Bookmark the permalink.

發表迴響

您的電子郵件位址並不會被公開。 必要欄位標記為 *

*

您可以使用這些 HTML 標籤與屬性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>