形如p+p的有趣現象

把例子擺出來先,在非ie瀏覽器中打開後,能看到例子效果: 

演示地址:http://www.doyoe.com/model/xhtmlcss/style/pp.htm] 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<style type="text/css">
p+p {text-indent:2em; color:#f00;}
</style>
</head>
<body>
<fieldset><legend>第一種情況</legend>
<p>test</p>
<p>test</p>
<br />
<p>test</p>
</fieldset>
<fieldset><legend>第二種情況</legend>
<p>test</p>
<br />
<p>test</p>
<p>test</p>
</fieldset>
<fieldset><legend>第三種情況</legend>
<p>test</p>
純文字
<p>test</p>
<p>test</p>
</fieldset>
<fieldset><legend>第四種情況</legend>
<p>test</p>
<p>test</p>
<p>test</p>
</fieldset>
</body>
</html>

很顯然,由第一,第二種情況,我們能看出p+p是指緊隨着某個p的p,之間不能被間斷。

由第二,第三種情況,我們又能看出所謂p+p之間不能被間斷,是指不被其他html元素隔斷,單純的文本不在其列。

由第四種情況,我們可以看出連續的p之間,從第一個p開始,每個p會自動成下一個p的“p+p”中的前一個p。

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章