亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - How to select text background color after adding ID in front of ::selection, how to make it compatible with browsers?
給我你的懷抱
給我你的懷抱 2017-05-19 10:36:57
0
2
733

Select text background color

 ::selection { background-color: rgba(222,169,19,1.00) }

When <html id="c-1">,

#c-1 ::-moz-selection { background-color: rgba(222,169,19,1.00) }
#c-1 ::selection { background-color: rgba(222,169,19,1.00) }

It only works on Firefox, but not on Google Chrome.
Tried it

#c-1 ::-webkit-selection { background-color: rgba(222,169,19,1.00) }

is of no use either. The desired effect is that when replacing the ID in HTML, the background color of the selected text will also be replaced. How to write it so that webkit can understand it. .


What was originally written is correct. It is estimated that there was an error elsewhere and the problem has been solved.

給我你的懷抱
給我你的懷抱

reply all(2)
某草草

Webkit doesn’t need to add -wekbit-, selection can work directly

Did you add an extra space between id and ::?

#c-1::-moz-selection { background-color: rgba(222,169,19,1.00) }
過去多啦不再A夢

There is an extra space between your selector and colon

<style type="text/css">
            h2::-moz-selection {
                background-color: rgba(222, 169, 19, 1.00)
            }
            
            h2::selection {
                background-color: rgba(222, 169, 19, 1.00)
            }
        </style>
        <h2>
            減肥的撒嬌發(fā)多少就浪費大家愛看范德薩家樂福的撒嬌范德薩六角恐龍
        </h2>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template