曝光臺 注意防騙
網曝天貓店富美金盛家居專營店坑蒙拐騙欺詐消費者
whether societies of men are really capable or not of
establishing good government from reflection and choice,or
whether they are forever destined to depend for their political
constitutions on accident and force.If there be any truth in
the remark,the crisis at which we are arrived may with
propriety be regarded as the era in which that decision is to
be made;and a wrong election of the part we shall act may,in
this view,deserve to be considered as the general misfortune
of mankind.
</P>
你以前學過的可能是把<P>看作一個段落的結束,現在應當把它看作一個開始。這會帶來一些好處,例如可以方便地為一個
段落指定多種格式化屬性。例如,下面是可在http://thomas.loc.gov/home/hres581.html 上看到的 House Resolution 581
的原始HTML 標題:
XML 實用大全
第 149 頁
<center>
<p><h2>House Calendar No.272</h2>
<p><h1>105TH CONGRESS 2D SESSION H.RES.581</h1>
<p>[Report No.105-795 ]
<p><b>Authorizing and directing the Committee on the
Judiciary to investigate whether sufficient grounds
exist for the impeachment of William Jefferson Clinton,
President of the United States.</b>
</center>
下面是同樣的文本,但使用的是結構完整的HTML。Align 屬性代替了相應的center 元素,并且使用CSS 樣式屬性代替了<b>
標記。
<h2 align="center">House Calendar No.272</h2>
<h1 align="center">105TH CONGRESS 2D SESSION H.RES.581</h1>
<p align="center">[Report No.105-795 ]</p>
<p align="center" style="font-weight:bold">
Authorizing and directing the Committee on the Judiciary to
investigate whether sufficient grounds exist for the
impeachment of William Jefferson Clinton,
President of the United States.
</p>
6.4.1.2 刪除孤立的結束標記并且不要使元素重疊
在編輯頁面時,刪除一個起始標記而忘了刪除相應的結束標記,這種情況很常見。在HTML 中,一個孤立的結束標記如
</STRONG>或者</TD>沒有任何相匹配的起始標記不會引發問題。但是這樣會使文件比需要的更長,下載速度變慢,而且潛在
地使人或工具理解和編輯HTML 源文件發生混淆。因此應當確保每個結束標記都有正確的起始標記。
但是結束標記沒有任何起始標記往往意味著那些元素錯誤地重疊了。在Web 頁面上的大部分重疊元素很容易修改。例如下面
這種常見的錯誤:
XML 實用大全
第 150 頁
<B><I>This text is bold and italic</B></I>
I 元素在B 元素中開始,也必須在B 元素中結束。需要做的只是交換兩個結束標記的位置:
<B><I>This text is bold and italic</I></B>
同樣可以交換兩個起始標記:
<I><B>This text is bold and italic</B></I>
偶爾會遇到一個棘手的問題。例如,下面是來自白宮主頁的一個片段(http://www.whitehouse.gov/,1998 年11 月4 日)。
其中已醒目地標出了有問題的標記,很容易看出錯誤所在:
<TD valign=TOP width=85>
<FONT size=+1>
<A HREF="/WH/New"><img border=0
src="/WH/images/pin_calendar.gif"
align=LEFT height=50 width=75 hspace=5 vspace=5></A><br></TD>
<TD valign=TOP width=225>
<A HREF="/WH/New"><B>What ’s New:</B></A><br>
</FONT>
What’s happening at the White <nobr>House -</nobr><br>
<font size=2><b>
<!-- New Begin -->
<a href="/WH/New/html/19981104-12244.html">Remarks Of The
President Regarding Social Security</a>
<BR>
<!-- New End -->
</font>
</b>
</TD>
XML 實用大全
第 151 頁
其中,<FONT size=+1>元素在第一個<TD valign=TOP width=85>元素中開始,但是它的后續部分越過該元素結束于另一個<TD
valign=TOP width=225>元素中。在此情況下,正確的處理方法是在第一個</TD>結束標記之前立即結束<FONT size=+1>起始
標記,然后在第二個TD 元素開始之后立即添加一個新的<FONT size=+1>起始標記,如下所示:
<TD valign=TOP width=85>
<FONT size=+1>
<A HREF="/WH/New"><img border=0
src="/WH/images/pin_calendar.gif"
align=LEFT height=50 width=75 hspace=5 vspace=5></A><br>
</FONT></TD>
<TD valign=TOP width=225>
<FONT size=+1>
<A HREF="/WH/New"><B>What ’s New:</B></A><br>
</FONT>
What ’s happening at the White <nobr>House -</nobr><br>
<font size=2><b>
<!-- New Begin -->
<a href="/WH/New/html/19981104-12244.html">Remarks Of The
President Regarding Social Security</a>
<BR>
<!-- New End -->
</font>
中國航空網 www.k6050.com
航空翻譯 www.aviation.cn
本文鏈接地址:
XML實用大全(47)