css禁止復(fù)制的方法是通過(guò)【user-select】屬性設(shè)置不可復(fù)制的css代碼,語(yǔ)法【user-select:none |text| all | element】。
本教程操作環(huán)境:windows7系統(tǒng)、css3版,DELL G3電腦。
css禁止復(fù)制的方法:
通過(guò)user-select屬性設(shè)置不可復(fù)制的css代碼:
-moz-user-select:none; /* Firefox私有屬性 */ -webkit-user-select:none; /* WebKit內(nèi)核私有屬性 */ -ms-user-select:none; /* IE私有屬性(IE10及以后) */ -khtml-user-select:none; /* KHTML內(nèi)核私有屬性 */ -o-user-select:none; /* Opera私有屬性 */ user-select:none; /* CSS3屬性 */
IE6-9不支持該屬性,但支持使用標(biāo)簽屬性onselectstart=”return false;”來(lái)達(dá)到user-select:none的效果。
user-select
語(yǔ)法:
user-select:none |text| all | element
默認(rèn)值:text
適用于:除替換元素外的所有元素
繼承性:無(wú)
動(dòng)畫(huà)性:否
計(jì)算值:指定值
取值:
none:文本不能被選擇
text:可以選擇文本
all:當(dāng)所有內(nèi)容作為一個(gè)整體時(shí)可以被選擇。如果雙擊或者在上下文上點(diǎn)擊子元素,那么被選擇的部分將是以該子元素向上回溯的最高祖先元素。
element:可以選擇文本,但選擇范圍受元素邊界的約束
相關(guān)學(xué)習(xí)推薦:css教程