使用::selection{}來(lái)重新設(shè)計(jì)背景顏色和文字顏色時(shí),出現(xiàn)選擇超出了我選擇范圍的情況,這是為什么呢?
代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<style type="text/css">
p::selection{
background: orange;
color: green;
?}
? ? ? ? ? ? #con{
? ? ? ? ? ? ?width: 600px;
? ? ? ? ? ? ?height: 700px;
? ? ? ? ? ? ?border: 1px solid green;
? ? ? ? ? ? ?margin: 20px auto;
? ? ? ? ? ? ?border-radius: 5%;
? ? ? ? ? ? ?box-shadow: -5px 3px 6px green;
? ? ? ? ? ? }
? ? ? ? ? ? #con .head{
? ? ? ? ? ? ?width: 500px;
? ? ? ? ? ? ?height: 60px;
? ? ? ? ? ? ?border: 1px solid green;
? ? ? ? ? ? ?margin-top: 10px;
? ? ? ? ? ? ?border-radius: 5%;
? ? ? ? ? ? ?margin: 0 auto;
? ? ? ? ? ? ?box-shadow: -5px 3px 6px green;
? ? ? ? ? ? ?text-align: center;
? ? ? ? ? ? ?line-height: 60px;
? ? ? ? ? ? ?font-size: 18px;
? ? ? ? ? ? ?font-weight: bold;
? ? ? ? ? ?
? ? ? ? ? ? ?font-family: 微軟雅黑;
? ? ? ? ? ? ?color:green;
? ? ? ? ? ? }
? ? ? ? ? ? #con .main{
? ? ? ? ? ? ?padding: 20px;
? ? ? ? ? ? }
? ? ? ? ? ? .main p{text-indent:2em; }
</style>
</head>
<body>
<div id="con">
<div>將被選中的文字顯示的背景顏色和文字給成特別的顏色</div>
<div>
<p>
狐貍說(shuō):“對(duì)我來(lái)說(shuō),你只是一個(gè)小男孩,就像其他成千上萬(wàn)個(gè)小男孩一樣沒(méi)有什么兩樣。我不需要你。你也不需要我。對(duì)你來(lái)說(shuō),我也只是一只狐貍,和其他成千上萬(wàn)的狐貍沒(méi)有什么不同。但是,如果你馴養(yǎng)了我,我們就會(huì)彼此需要。對(duì)我來(lái)說(shuō),你就是我的世界里獨(dú)一無(wú)二的了;我對(duì)你來(lái)說(shuō),也是你的世界里的唯一了?!?/p>
</p>
</div>
</div>
</body>
</html>
2016-08-11
?#con .head??#con .main ?這是什么鬼。。。
2015-12-23
搞清楚什么叫塊級(jí)元素,什么叫行級(jí)元素。