1. 程式人生 > >CSS3選擇器selection--改變選中文字的顏色

CSS3選擇器selection--改變選中文字的顏色

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<style>
			p::selection{
				background: blue;
				color: red;
			}
		</style>
	</head>
	<body>
		<p>
			我將在被你選中後變為藍底紅字
		</p>
	</body>
</html>

效果: