{"id":229,"date":"2007-09-18T00:00:00","date_gmt":"2007-09-18T00:00:00","guid":{"rendered":"http:\/\/www.strongd.net\/?p=229"},"modified":"2007-09-18T00:00:00","modified_gmt":"2007-09-18T00:00:00","slug":"Syntax Rules of XHTML MP","status":"publish","type":"post","link":"https:\/\/www.strongd.net\/?p=229","title":{"rendered":"Syntax Rules of XHTML MP"},"content":{"rendered":"<p><P><FONT class=mainText>XHTML MP is a subset of XHTML. The syntax rules of XHTML MP follow that of XHTML.<\/FONT><\/P><br \/><P><FONT class=mainText>As mentioned before in this XHTML MP tutorial, XHTML is just a stricter and cleaner form of HTML. If you have already learned HTML, you can immediately start writing XHTML MP markup code by following the XHTML MP syntax rules below.<\/FONT><\/P><br \/><P><BR><\/P><br \/><OL><br \/><LI><br \/><P><FONT class=mainText>Tags must be closed properly<\/FONT><\/P><br \/><LI><br \/><P><FONT class=mainText>Tags and attributes must be in lowercase<\/FONT><\/P><br \/><LI><br \/><P><FONT class=mainText>Value of attributes must be enclosed within quotation marks<\/FONT><\/P><br \/><LI><br \/><P><FONT class=mainText>No attribute minimization is allowed<\/FONT><\/P><br \/><LI><br \/><P><FONT class=mainText>Tags must be nested properly<\/FONT><\/P><\/LI><\/OL><br \/><P><BR><\/P><br \/><H2><A name=\"5.1.XHTML MP Syntax Rule 1: Tags Must Be Closed Properly|outline\"><\/A>XHTML MP Syntax Rule 1: Tags Must Be Closed Properly<\/H2><br \/><P><FONT class=mainText>All tags in XHTML MP must be closed properly. For example, the following code is not correct in XHTML MP since the &lt;\/p&gt; end tag is missing. (In case you do not know, the &lt;p&gt;&lt;\/p&gt; tags are used to enclose a paragraph of text.)<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;p&gt;XHTML MP tutorial paragraph 1<BR>&lt;p&gt;XHTML MP tutorial paragraph 2<BR>&lt;p&gt;XHTML MP tutorial paragraph 3<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>This is correct in XHTML MP:<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;p&gt;XHTML MP tutorial paragraph 1&lt;\/p&gt;<BR>&lt;p&gt;XHTML MP tutorial paragraph 2&lt;\/p&gt;<BR>&lt;p&gt;XHTML MP tutorial paragraph 3&lt;\/p&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>Some tags in XHTML MP do not come in pairs since there is no content to be enclosed. One example is the &lt;br&gt; tag that is used for line breaking. To close such tags, you put a &#8220;\/&#8221; at the end of the tag before &#8220;&gt;&#8221;. For example, the closed version of &lt;br&gt; is &lt;br\/&gt;.<\/FONT><\/P><br \/><P><FONT class=mainText>The following markup code is not correct in XHTML MP since the &lt;br&gt; tag is not self-closed.<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>Line break&lt;br&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>This is correct in XHTML MP:<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>Line break&lt;br\/&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>Note that to make the XHTML MP markup code compatible with some older web browsers on the PC, you have to leave a space before \/&gt;, like this:<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>Line break&lt;br \/&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><H2><A name=\"5.2.XHTML MP Syntax Rule 2: Tags and Attributes Must Be in Lowercase|outline\"><\/A>XHTML MP Syntax Rule 2: Tags and Attributes Must Be in Lowercase<\/H2><br \/><P><FONT class=mainText>XHTML MP markup code is case-sensitive. All tags and attributes in XHTML MP must be in lowercase. The following markup code is not correct in XHTML MP since tags (&lt;P&gt;&lt;\/P&gt;) and attributes (ID) are in uppercase.<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;P ID=&#8221;p1&#8243;&gt;XHTML MP tutorial paragraph 1&lt;\/P&gt;<BR>&lt;P ID=&#8221;p2&#8243;&gt;XHTML MP tutorial paragraph 2&lt;\/P&gt;<BR>&lt;P ID=&#8221;p3&#8243;&gt;XHTML MP tutorial paragraph 3&lt;\/P&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>The following markup code is correct in XHTML MP.<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;p id=&#8221;p1&#8243;&gt;XHTML MP tutorial paragraph 1&lt;\/p&gt;<BR>&lt;p id=&#8221;p2&#8243;&gt;XHTML MP tutorial paragraph 2&lt;\/p&gt;<BR>&lt;p id=&#8221;p3&#8243;&gt;XHTML MP tutorial paragraph 3&lt;\/p&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><H2><A name=\"5.3.XHTML MP Syntax Rule 3: Value of Attributes Must Be Enclosed within Quotation Marks|outline\"><\/A>XHTML MP Syntax Rule 3: Value of Attributes Must Be Enclosed within Quotation Marks<\/H2><br \/><P><FONT class=mainText>Value of attributes must be enclosed within quotation marks in XHTML MP. You can either use single quotes or double quotes. The following markup code is incorrect in XHTML MP.<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;p id=<B>p1<\/B>&gt;XHTML MP tutorial paragraph 1&lt;\/p&gt;<BR>&lt;p id=<B>p2<\/B>&gt;XHTML MP tutorial paragraph 2&lt;\/p&gt;<BR>&lt;p id=<B>p3<\/B>&gt;XHTML MP tutorial paragraph 3&lt;\/p&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>This is correct in XHTML MP:<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;p id=<B>&#8220;p1&#8221;<\/B>&gt;XHTML MP tutorial paragraph 1&lt;\/p&gt;<BR>&lt;p id=<B>&#8220;p2&#8221;<\/B>&gt;XHTML MP tutorial paragraph 2&lt;\/p&gt;<BR>&lt;p id=<B>&#8220;p3&#8221;<\/B>&gt;XHTML MP tutorial paragraph 3&lt;\/p&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>You can also use single quotes to enclose attribute values.<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;p id=<B>&#8216;p1&#8217;<\/B>&gt;XHTML MP tutorial paragraph 1&lt;\/p&gt;<BR>&lt;p id=<B>&#8216;p2&#8217;<\/B>&gt;XHTML MP tutorial paragraph 2&lt;\/p&gt;<BR>&lt;p id=<B>&#8216;p3&#8217;<\/B>&gt;XHTML MP tutorial paragraph 3&lt;\/p&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><H2><A name=\"5.4.XHTML MP Syntax Rule 4: No Attribute Minimization is Allowed|outline\"><\/A>XHTML MP Syntax Rule 4: No Attribute Minimization is Allowed<\/H2><br \/><P><FONT class=mainText>For some attributes, there is only one possible value. In HTML, you can leave out the attribute value in such cases. This is called attribute minimization. For example, in the following markup code, we define a check box that is initially in the checked state. As the <I>checked<\/I> attribute can only take the &#8220;checked&#8221; value, you can omit the &#8220;checked&#8221; value in HTML. The web browser knows that the value of the <I>checked<\/I> attribute must be &#8220;checked&#8221;.<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;input type=&#8221;checkbox&#8221; checked \/&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>However, attribute minimization is not allowed in XHTML MP. The above markup code is incorrect in XHTML MP. To correct it, you must write the attribute-value pair in full, like this:<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;input type=&#8221;checkbox&#8221; checked=&#8221;checked&#8221; \/&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>Below is another example. The following markup code defines a selection list with three options: &#8220;XHTML MP Tutorial Part 1&#8221;, &#8220;XHTML MP Tutorial Part 2&#8221; and &#8220;XHTML MP Tutorial Part 3&#8221;. The <I>multiple<\/I> attribute is used to enable multiple item selection in the selection list, and the <I>selected<\/I> attribute is used to select the &#8220;XHTML MP Tutorial Part 2&#8221; option initially.<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;select <B>multiple<\/B>&gt;<BR>&nbsp;&nbsp;&lt;option&gt;XHTML MP Tutorial Part 1&lt;\/option&gt;<BR>&nbsp;&nbsp;&lt;option <B>selected<\/B>&gt;XHTML MP Tutorial Part 2&lt;\/option&gt;<BR>&nbsp;&nbsp;&lt;option&gt;XHTML MP Tutorial Part 3&lt;\/option&gt;<BR>&lt;\/select&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>The above markup code is correct in HTML but not in XHTML MP. To correct it, you need to write the attribute-value pair in full, like this:<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;select <B>multiple=&#8221;multiple&#8221;<\/B>&gt;<BR>&nbsp;&nbsp;&lt;option&gt;XHTML MP Tutorial Part 1&lt;\/option&gt;<BR>&nbsp;&nbsp;&lt;option <B>selected=&#8221;selected&#8221;<\/B>&gt;XHTML MP Tutorial Part 2&lt;\/option&gt;<BR>&nbsp;&nbsp;&lt;option&gt;XHTML MP Tutorial Part 3&lt;\/option&gt;<BR>&lt;\/select&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><H2><A name=\"5.5.XHTML MP Syntax Rule 5: Tags Must Be Nested Properly|outline\"><\/A>XHTML MP Syntax Rule 5: Tags Must Be Nested Properly<\/H2><br \/><DIV><br \/><P><FONT class=mainText>Tags must be nested properly in XHTML MP. Tag overlapping is not allowed. The following markup code is wrong in XHTML MP since the tags overlap. (&lt;b&gt;&lt;\/b&gt; and &lt;i&gt;&lt;\/i&gt; tags are used to change the text style to bold and italic respectively.)<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;p&gt;&lt;b&gt;XHTML MP tutorial paragraph 1&lt;\/p&gt;&lt;\/b&gt;<BR>&lt;i&gt;&lt;p&gt;XHTML MP tutorial paragraph 2&lt;\/i&gt;&lt;\/p&gt;<BR>&lt;p&gt;&lt;b&gt;&lt;i&gt;XHTML MP tutorial paragraph 3&lt;\/p&gt;&lt;\/i&gt;&lt;\/b&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>The following code is correct in XHTML MP. The tags are nested properly.<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;p&gt;&lt;b&gt;XHTML MP tutorial paragraph 1&lt;\/b&gt;&lt;\/p&gt;<BR>&lt;p&gt;&lt;i&gt;XHTML MP tutorial paragraph 2&lt;\/i&gt;&lt;\/p&gt;<BR>&lt;p&gt;&lt;b&gt;&lt;i&gt;XHTML MP tutorial paragraph 3&lt;\/i&gt;&lt;\/b&gt;&lt;\/p&gt;<\/FONT><\/P><\/DIV><\/p>\n","protected":false},"excerpt":{"rendered":"<p>XHTML MP is a subset of XHTML. The syntax rules of XHTML MP follow that of XHTML.As mentioned before in this XHTML MP tutorial, XHTML is just a stricter and cleaner form of HTML. If you have already learned HTML, you can immediately start writing XHTML MP markup code by following the XHTML MP syntax &hellip; <a href=\"https:\/\/www.strongd.net\/?p=229\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Syntax Rules of XHTML MP<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-229","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=229"}],"version-history":[{"count":0,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/229\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}