<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>HTML &#8211; Dular Sharma</title>
	<atom:link href="https://www.dularsharma.com/category/technology/html/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dularsharma.com</link>
	<description></description>
	<lastBuildDate>Wed, 08 May 2024 04:45:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Chapter 16. Forms, Get/Post, Action</title>
		<link>https://www.dularsharma.com/chapter-16-forms-get-post-action/</link>
					<comments>https://www.dularsharma.com/chapter-16-forms-get-post-action/#respond</comments>
		
		<dc:creator><![CDATA[Dular Sharma]]></dc:creator>
		<pubDate>Tue, 05 May 2020 13:12:00 +0000</pubDate>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://www.dularsharma.com/?p=5773</guid>

					<description><![CDATA[138 Views Attributes Description accept-charset Determines which character encodings should be used for form submission. action Specifies the URL where the form data should be sent upon submission. autocomplete Controls whether the browser should enable or disable autocomplete for the form fields. enctype Defines how the form data should be encoded before sending it to [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 138</span><span class='epvc-label'> Views</span></div>
<figure class="wp-block-table"><table><tbody><tr><th><strong>Attributes</strong></th><th><strong>Description</strong></th></tr><tr><td><code>accept-charset</code></td><td>Determines which character encodings should be used for form submission.</td></tr><tr><td><code>action</code></td><td>Specifies the URL where the form data should be sent upon submission.</td></tr><tr><td><code>autocomplete</code></td><td>Controls whether the browser should enable or disable autocomplete for the form fields.</td></tr><tr><td><code>enctype</code></td><td>Defines how the form data should be encoded before sending it to the server, particularly for the <code>post</code> method.</td></tr><tr><td><code>method</code></td><td>Specifies the HTTP method to be used when sending the form data, either <code>POST</code> or <code>GET</code>.</td></tr><tr><td><code>name</code></td><td>Assigns a name to the form, which can be used for identification and scripting purposes.</td></tr><tr><td><code>novalidate</code></td><td>Indicates that the form should skip validation when submitted.</td></tr><tr><td><code>target</code></td><td>Specifies where the response from the form submission should be displayed.</td></tr></tbody></table></figure>



<p>HTML utilizes the <code>&lt;form&gt;</code> element to group input fields and facilitate the submission of data. These forms play a crucial role in transmitting data to a server or handler using the specified method. This guide provides an overview and practical demonstrations of using HTML forms to collect and submit input data.</p>



<h3 class="wp-block-heading" id="Form-Submission"><strong>Form Submission</strong></h3>



<p><strong>The Action Attribute:</strong><br>The <code>action</code> attribute specifies the destination where the form data will be sent upon submission. Typically, this points to a script that processes the submitted information.</p>



<p><code>&lt;form action="action.php"&gt;</code></p>



<p><strong>The Method Attribute:</strong><br>The <code>method</code> attribute determines the HTTP method to be used for form submission, which can be either <code>GET</code> or <code>POST</code>.</p>



<p><code>&lt;form action="action.php" method="get"&gt; &lt;form action="action.php" method="post"&gt;</code></p>



<p>The <strong>GET </strong>method is commonly used to retrieve data, like fetching a post by its ID or name, or executing a search query. It appends the form data to the URL specified in the <code>action</code> attribute.</p>



<p>Example:</p>



<p><code>www.abc.com/action.php?firstName= Mozila &amp; lastName= Firefox</code></p>



<p>The <strong>POST </strong>method, on the other hand, is utilized when submitting data to a script. It does not append the form data to the action URL but sends it within the request body.</p>



<p>To ensure proper submission of form data, each input field must have a <code>name</code> attribute.</p>



<p>For instance, to send the value of a field named <code>lastname</code>:</p>



<p><code>&lt;input type="text" name="lastName" value="Chrome"&gt;</code></p>



<p><strong>Additional Attributes:</strong></p>



<p><code>&lt;form action="action.php" method="post" target="_blank" accept-charset="UTF-8" enctype="application/x-www-form-urlencoded" autocomplete="off" novalidate&gt; <em>&lt;!-- form elements --&gt;</em> &lt;/form&gt;</code></p>



<h3 class="wp-block-heading" id="Target-Attribute-in-Form-Tag"><strong>Target Attribute in Form Tag</strong></h3>



<p>The <code>target</code> attribute specifies where the response from the form submission should be displayed.</p>



<p>Values:</p>



<ul class="wp-block-list">
<li><code>_blank</code>: Response is displayed in a new window or tab.</li>



<li><code>_self</code> (default): Response is displayed in the same frame.</li>



<li><code>_parent</code>: Response is displayed in the parent frame.</li>



<li><code>_top</code>: Response is displayed in the entire window.</li>



<li><code>framename</code>: Response is displayed in a named iframe.</li>
</ul>



<p>Note: The <code>target</code> attribute was deprecated in HTML 4.01 but is supported in HTML5. Although frames and framesets are not supported in HTML5, these values are still used, primarily with iframes.</p>



<h3 class="wp-block-heading" id="Uploading-Files"><strong>Uploading Files</strong></h3>



<p>To upload images and files to a server, you need to specify the <code>enctype</code> attribute of the form tag as <code>multipart/form-data</code>. This attribute determines how the form data will be encoded for submission.</p>



<p>Example:</p>



<pre class="wp-block-code"><code><code>&lt;form method="post" enctype="multipart/form-data" action="upload.php"&gt; &lt;input type="file" name="Picture" /&gt; &lt;input type="submit" value="Upload" /&gt; &lt;/form&gt;</code></code></pre>



<h3 class="wp-block-heading" id="Grouping-Input-Fields"><strong>Grouping Input Fields</strong></h3>



<p>When designing a form, it&#8217;s helpful to group related input fields together to maintain a structured layout. This can be achieved using the <code>&lt;fieldset&gt;</code> tag.</p>



<p>You can add a title to each group using the <code>&lt;legend&gt;</code> tag.</p>



<p><strong>Example:</strong></p>



<pre class="wp-block-code"><code><code>&lt;form&gt; &lt;fieldset&gt; &lt;legend&gt;Full Name:&lt;/legend&gt; First Name:&lt;br&gt; &lt;input type="text"&gt;&lt;br&gt; Last Name:&lt;br&gt; &lt;input type="text"&gt;&lt;br&gt; &lt;/fieldset&gt;&lt;br&gt; &lt;fieldset&gt; &lt;legend&gt;Personal Information:&lt;/legend&gt; Country:&lt;br&gt; &lt;input type="text"&gt;&lt;br&gt; State:&lt;br&gt; &lt;input type="text"&gt;&lt;br&gt; &lt;/fieldset&gt;&lt;br&gt; &lt;input type="submit" value="Done"&gt; &lt;/form&gt;</code></code></pre>



<p><strong>Result:</strong><br>This will create a structured form layout with grouped input fields.</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="335" height="419" src="https://www.dularsharma.com/wp-content/uploads/2024/04/image-6.png" alt="" class="wp-image-5774" srcset="https://www.dularsharma.com/wp-content/uploads/2024/04/image-6.png 335w, https://www.dularsharma.com/wp-content/uploads/2024/04/image-6-240x300.png 240w" sizes="(max-width: 335px) 100vw, 335px" /></figure>



<p><strong>Browser Support:</strong><br>The <code>&lt;fieldset&gt;</code> tag is supported by the latest versions of Chrome, IE, Edge, Firefox, Safari, and Opera.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dularsharma.com/chapter-16-forms-get-post-action/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Chapter 15. Images in HTML</title>
		<link>https://www.dularsharma.com/chapter-15-images-in-html/</link>
					<comments>https://www.dularsharma.com/chapter-15-images-in-html/#respond</comments>
		
		<dc:creator><![CDATA[Dular Sharma]]></dc:creator>
		<pubDate>Mon, 04 May 2020 13:11:00 +0000</pubDate>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://www.dularsharma.com/?p=5771</guid>

					<description><![CDATA[128 Views Parameters Description src Specifies the URL of the image. srcset Provides images for different scenarios (e.g., high-resolution displays, small monitors, etc.). sizes Defines image sizes between breakpoints. crossorigin Determines how the element handles crossorigin requests. usemap Specifies the name of the image map to use. ismap Indicates whether the image is a server-side [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 128</span><span class='epvc-label'> Views</span></div>
<figure class="wp-block-table"><table><tbody><tr><th><strong>Parameters</strong></th><th><strong>Description</strong></th></tr><tr><td><strong>src</strong></td><td>Specifies the URL of the image.</td></tr><tr><td><strong>srcset</strong></td><td>Provides images for different scenarios (e.g., high-resolution displays, small monitors, etc.).</td></tr><tr><td><strong>sizes</strong></td><td>Defines image sizes between breakpoints.</td></tr><tr><td><strong>crossorigin</strong></td><td>Determines how the element handles crossorigin requests.</td></tr><tr><td><strong>usemap</strong></td><td>Specifies the name of the image map to use.</td></tr><tr><td><strong>ismap</strong></td><td>Indicates whether the image is a server-side image map.</td></tr><tr><td><strong>alt</strong></td><td>Offers alternative text to display if the image cannot be shown for any reason.</td></tr><tr><td><strong>wodth</strong></td><td>Specifies the width of the image (optional).</td></tr><tr><td><strong>height</strong></td><td>Specifies the height of the image (optional).</td></tr></tbody></table></figure>



<h3 class="wp-block-heading" id="Creating-an-Image"><strong>Creating an Image</strong></h3>



<p>To insert an image into a page, utilize the image tag. Image tags <strong>(img</strong>) do not require closing tags. The main attributes for the <strong>img</strong> tag are <strong>src </strong>(the image source) and <strong>alt</strong> (alternative text describing the image).</p>



<p><code>&lt;img src="images/img.png" alt="This is an Image"&gt;</code></p>



<p>Images can also be sourced from web URLs:</p>



<p><code>&lt;img src="https://unsplash.com/photos/a-person-typing-on-a-keyboard-at-a-desk-hbMk23Z2ErA" alt="Image of Laptop Desk"&gt;</code></p>



<p>Note: Images are linked to HTML pages; they are not technically inserted into the HTML page. The <strong>&lt;img&gt; </strong>tag creates a space for the referenced image. It is also possible to embed images directly into the page using base64:</p>



<p><code>&lt;img src="https://unsplash.com/photos/a-person-typing-on-a-keyboard-at-a-desk-hbMk23Z2ErA" alt="Image Of Laptop Desk"&gt;</code></p>



<p>Tip: To link an image to another document, nest the <strong>&lt;img&gt;</strong> tag within <strong>&lt;a&gt; </strong>tags.</p>



<h3 class="wp-block-heading" id="Choosing-Alt-Text"><strong>Choosing Alt Text</strong></h3>



<p><strong>Alt-text</strong> is crucial for screen readers and search engines. It should accurately describe the image&#8217;s content. For example:</p>



<p><code>&lt;img src="img.png" alt="This is an Image"/&gt; This is written in the Blog &lt;a href="https://google.com/"&gt;&lt;img src="Previous.png" alt="Previous Button"/&gt;&lt;/a&gt; / &lt;a href="https://google.com/"&gt;&lt;img src="Next.png" alt="Next Button"/&gt;&lt;/a&gt;</code></p>



<p>Without the images, this would look like:</p>



<p>This is an Image This is written in the Blog</p>



<p>Previous Button / Next Button</p>



<p>To correct this:</p>



<ul class="wp-block-list">
<li>Remove the <strong>alt-text</strong> as it adds redundant information.</li>



<li>Remove &#8220;<strong>Button</strong>&#8221; from the alt-text for the icons, focusing on their function.</li>
</ul>



<p><code>&lt;img src="img.png" alt="/&gt; This is written in the Blog &lt;a href="https://google.com/"&gt;&lt;img src="Previous.png" alt="Previous"/&gt;&lt;/a&gt; / &lt;a href="https://google.com/"&gt;&lt;img src="Next.png" alt="Next"/&gt;&lt;/a&gt;</code></p>



<p>The presence or absence of the alt attribute conveys a semantic difference. An empty alt attribute implies that the image is supplementary to the content and can be omitted from rendering without affecting comprehension. Conversely, the absence of the alt attribute suggests that the image is integral to the content, and there is no textual equivalent available for rendering.</p>



<p><strong>Responsive Image using the srcset Attribute Utilizing srcset with sizes:</strong></p>



<p><strong>Srcset with Size:</strong></p>



<p><code>&lt;img sizes="(min-width: 1200px) 580px, (min-width: 640px) 48vw, 98vw" srcset="img/img1.jpg 300w, img/img2.jpg 600w, img/img3.jpg 900w, img/img4.jpg 1200w" src="img/img5.jpg" alt="images"&gt;</code></p>



<p>Sizes attribute functions akin to media queries, dictating the space an image occupies within the viewport. For instance:</p>



<ul class="wp-block-list">
<li>If the viewport exceeds 1200px, the image spans precisely 580px, aligning with a centered content container of maximum 1200px width.</li>



<li>In the range of 640px to 1200px, the image occupies 48% of the viewport&#8217;s width, adapting to the page&#8217;s scale.</li>



<li>For viewports below 640px, the image expands to 98% of the viewport&#8217;s width, ensuring full coverage. The media condition is omitted for this scenario.</li>
</ul>



<p><strong>Srcset </strong>informs the browser about available image options and their respective sizes. For instance:</p>



<ul class="wp-block-list">
<li>img/img1.jpg is 300px wide,</li>



<li>img/img2.jpg is 600px wide,</li>



<li>img/img3.jpg is 900px wide,</li>



<li>img/img4.jpg is 1200px wide.</li>
</ul>



<p>The <strong>src </strong>attribute is obligatory for specifying the image source. In cases where <strong>srcset </strong>is used, <strong>src </strong>serves as a fallback image if the browser does not support <strong>srcset</strong>.</p>



<p><strong>Using srcset without sizes:</strong></p>



<p><code>&lt;img src="img/img1.jpg" alt="images" srcset="img/img1.jpg 1x, img/img2.jpg 2x, img/img3.jpg 3x"&gt;</code></p>



<p>This indicates available images based on the device-pixel ratio:</p>



<ul class="wp-block-list">
<li>For a device-pixel ratio of 1, img/img1.jpg is utilized.</li>



<li>For a ratio of 2, img/img2.jpg is chosen.</li>



<li>For a ratio of 3, img/img3.jpg is preferred.</li>
</ul>



<h3 class="wp-block-heading" id="Responsive-Image-using-the-Picture-Element-Code:"><strong>Responsive Image using the Picture Element Code:</strong></h3>



<p><code>&lt;picture&gt; source media="(min-width: 600px)" srcset="Img1.jpg"&gt; &lt;source media="(min-width: 450px)" srcset="Img2.jpg"&gt; &lt;img src="Img3.jpg" style="width:auto;"&gt; &lt;/picture&gt;</code></p>



<p><strong>Usage:</strong></p>



<p>Include all images using the <strong>source </strong>tag within a picture tag.</p>



<p><strong>Result:</strong></p>



<p>On screens with a <strong>width &gt;600px</strong>, it shows img1.jpg. On screens with a <strong>width &gt;450px</strong>, it shows Img2.jpg. On screens with <strong>other widths</strong>, it shows Img3.jpg.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dularsharma.com/chapter-15-images-in-html/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Chapter 14. Utilizing HTML in Conjunction with CSS</title>
		<link>https://www.dularsharma.com/chapter-14-utilizing-html-in-conjunction-with-css/</link>
					<comments>https://www.dularsharma.com/chapter-14-utilizing-html-in-conjunction-with-css/#respond</comments>
		
		<dc:creator><![CDATA[Dular Sharma]]></dc:creator>
		<pubDate>Sun, 03 May 2020 13:09:00 +0000</pubDate>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://www.dularsharma.com/?p=5769</guid>

					<description><![CDATA[132 Views CSS enriches the presentation of HTML elements within a webpage. Inline styling, executed through the style attribute within tags, is generally discouraged. Internal stylesheets, facilitated by the &#60;style&#62; tag, allow for the declaration of rules pertinent to specific sections of the page. Additionally, external stylesheets can be incorporated via the &#60;link&#62; tag, linking [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 132</span><span class='epvc-label'> Views</span></div>
<p>CSS enriches the presentation of HTML elements within a webpage. Inline styling, executed through the style attribute within tags, is generally discouraged. Internal stylesheets, facilitated by the <strong>&lt;style&gt;</strong> tag, allow for the declaration of rules pertinent to specific sections of the page. Additionally, external stylesheets can be incorporated via the <strong>&lt;link&gt;</strong> tag, linking to an external CSS file and implementing its rules across the document. This discussion encompasses the application of all three attachment methods.</p>



<p><strong>Utilizing External Stylesheets</strong><br>To employ an external stylesheet, incorporate the link attribute within the document&#8217;s head:</p>



<p><code>&lt;head&gt; &lt;link rel="stylesheet" type="text/css" href="style.css"&gt; &lt;/head&gt;</code></p>



<p>External stylesheets can also be sourced from websites through a content delivery network (CDN), such as Bootstrap:</p>



<p><code>&lt;head&gt; &lt;link rel="stylesheet" href="&lt;https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css&gt;" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"&gt; &lt;/head&gt;</code></p>



<p>CDN support for various frameworks is typically available on their respective websites.</p>



<p><strong>Internal Stylesheet</strong><br>CSS elements can also be included internally using the <strong>&lt;style&gt;</strong> tag:</p>



<p><code>&lt;head&gt; &lt;style type="text/css"&gt; body { background-color: blue; } &lt;/style&gt; &lt;/head&gt;</code></p>



<p>Multiple internal stylesheets can be included within a program:</p>



<p><code>&lt;head&gt; &lt;style type="text/css"&gt; body { background-color: blue; } &lt;/style&gt; &lt;style type="text/css"&gt; p { background-color: red; } &lt;/style&gt; &lt;/head&gt;</code></p>



<p><strong>Inline Styling</strong><br>Specific elements can be styled using the <strong>style</strong> attribute:</p>



<p>&lt;span style=&#8221;color: red&#8221;>This text will be red.&lt;/span></p>



<p>Note: Inline styling is discouraged as it hampers the separation of content and presentation.</p>



<p><strong>Multiple Stylesheets</strong><br>Multiple stylesheets can be loaded, with later files and declarations taking precedence over earlier ones:</p>



<p>&lt;head> &lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;style1.css&#8221;> &lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;style2.css&#8221;> &lt;/head></p>



<p>In cases of conflicting rules, the background color of the document, for example, will be determined by the latter declaration.</p>



<p>In above case, if style1 has property of background color “Black” and style2 has property of background color “Yellow”, as the last declaration is for style2, the background color will be Yellow.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dularsharma.com/chapter-14-utilizing-html-in-conjunction-with-css/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Chapter 13. Incorporating JavaScript in HTML</title>
		<link>https://www.dularsharma.com/incorporating-javascript-in-html/</link>
					<comments>https://www.dularsharma.com/incorporating-javascript-in-html/#respond</comments>
		
		<dc:creator><![CDATA[Dular Sharma]]></dc:creator>
		<pubDate>Sat, 02 May 2020 13:07:00 +0000</pubDate>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://www.dularsharma.com/?p=5763</guid>

					<description><![CDATA[135 Views Attribute Specification src Specifies the path to a JavaScript file, either relative or absolute. type Defines the MIME type; mandatory in HTML4, optional in HTML5. async Executes the script asynchronously (for external scripts); no value required except in XHTML. defer Executes the script after page parsing is complete (for external scripts); no value [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 135</span><span class='epvc-label'> Views</span></div>
<figure class="wp-block-table"><table><tbody><tr><th><strong>Attribute</strong></th><th><strong>Specification</strong></th></tr><tr><td><strong>src</strong></td><td>Specifies the path to a JavaScript file, either relative or absolute.</td></tr><tr><td><strong>type</strong></td><td>Defines the MIME type; mandatory in HTML4, optional in HTML5.</td></tr><tr><td><strong>async</strong></td><td>Executes the script asynchronously (for external scripts); no value required except in XHTML.</td></tr><tr><td><strong>defer</strong></td><td>Executes the script after page parsing is complete (for external scripts); no value required except in XHTML.</td></tr><tr><td><strong>charset</strong></td><td>Specifies the character encoding in an external script file, e.g., UTF-8.</td></tr><tr><td><strong>crossorigin</strong></td><td>Determines how the element handles crossorigin requests.</td></tr><tr><td><strong>nonce</strong></td><td>Utilized in Content Security Policy checks (CSP3).</td></tr></tbody></table></figure>



<p><strong>Dealing with Disabled JavaScript</strong></p>



<p>In scenarios where client browsers lack JavaScript support or have it disabled, potentially due to security concerns, informing users about script execution can be achieved using the <strong>&lt;noscript&gt;</strong> tag. The <strong>&lt;noscript&gt; </strong>content displays when JavaScript is disabled.</p>



<p>&lt;script> document.write(&#8220;Hello, world!&#8221;); &lt;/script> &lt;noscript>This browser does not support JavaScript.&lt;/noscript></p>



<p><strong>Linking to an External JavaScript File</strong></p>



<p>The src attribute functions akin to href for anchors, accepting absolute or relative URLs. Typically placed within the <strong>&lt;head&gt;</strong> tags at the document&#8217;s beginning.</p>



<p>&lt;script src=&#8221;JSfile.js&#8221;>&lt;/script></p>



<p><strong>Direct Inclusion of JavaScript Code</strong></p>



<p>Alternatively, instead of linking to an external file, JavaScript code can be directly embedded in HTML.</p>



<p><code>&lt;script&gt; //JS code &lt;/script&gt;</code></p>



<h3 class="wp-block-heading" id="Including-a-JavaScript-File-for-Asynchronous-Execution"><strong>Including a JavaScript File for Asynchronous Execution</strong></h3>



<p><code>&lt;script type="text/javascript" src="URL" async&gt;&lt;/script&gt;</code></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dularsharma.com/incorporating-javascript-in-html/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Chapter 12. Resource Linking</title>
		<link>https://www.dularsharma.com/chapter-12-resource-linking/</link>
					<comments>https://www.dularsharma.com/chapter-12-resource-linking/#respond</comments>
		
		<dc:creator><![CDATA[Dular Sharma]]></dc:creator>
		<pubDate>Fri, 01 May 2020 13:42:00 +0000</pubDate>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://www.dularsharma.com/?p=5754</guid>

					<description><![CDATA[134 Views Attribute Breakdown: Attribute Description charset Identifies the character encoding of the linked document. crossorigin Determines how the element handles requests from different origins. href Specifies the location of the linked document. hreglang Indicates the language used in the linked document&#8217;s text. media Specifies the device on which the linked document will be displayed, [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 134</span><span class='epvc-label'> Views</span></div>
<h3 class="wp-block-heading" id="Attribute-Breakdown:"><strong>Attribute Breakdown:</strong></h3>



<figure class="wp-block-table"><table><tbody><tr><th><strong>Attribute</strong></th><th><strong>Description</strong></th></tr><tr><td><strong>charset</strong></td><td>Identifies the character encoding of the linked document.</td></tr><tr><td><strong>crossorigin</strong></td><td>Determines how the element handles requests from different origins.</td></tr><tr><td><strong>href</strong></td><td>Specifies the location of the linked document.</td></tr><tr><td><strong>hreglang</strong></td><td>Indicates the language used in the linked document&#8217;s text.</td></tr><tr><td><strong>media</strong></td><td>Specifies the device on which the linked document will be displayed, commonly used with style sheet selection based on device characteristics.</td></tr><tr><td><strong>rel</strong></td><td>Essential. Describes the relationship between the current document and the linked one.</td></tr><tr><td><strong>rev</strong></td><td>Describes the relationship between the linked document and the current one.</td></tr><tr><td><strong>sizes</strong></td><td>Specifies the dimensions of the linked resource, applicable only when rel=&#8221;icon&#8221;.</td></tr><tr><td><strong>target</strong></td><td>Specifies where to load the linked document.</td></tr><tr><td><strong>type</strong></td><td>Identifies the media type of the linked document.</td></tr><tr><td><strong>integrity</strong></td><td>Provides a base64 encoded hash (sha256, sha384, or sha512) of the linked resource, allowing the browser to verify its authenticity.</td></tr></tbody></table></figure>



<p>Although scripts, icons, and stylesheets can be directly embedded into HTML markup, it is considered a best practice for efficiency and organization to include these resources in separate files and link them to your document. This section focuses on linking external resources such as stylesheets and scripts to an HTML document.</p>



<p><strong>JavaScript Loading Methods</strong><br><strong>Synchronous Loading:</strong></p>



<p><code>&lt;script src="jspath/to.js"&gt;&lt;/script&gt;</code></p>



<p>Conventionally, JavaScript <strong>&lt;script&gt;</strong> tags are positioned just before the closing <strong>&lt;/body&gt;</strong> tag. This practice enhances the rapid display of your website&#8217;s visuals and prevents potential issues where JavaScript attempts to interact with elements before they are fully loaded.</p>



<p><strong>Asynchronous Loading:</strong></p>



<p><code>&lt;script src="jspath/to.js" asynchronous&gt;&lt;/script&gt;</code></p>



<p>An alternative approach is asynchronous loading, suitable when the JavaScript code isn&#8217;t essential for page initialization. By utilizing async, the browser loads the script content in parallel with other page resources. Once fully downloaded, it interrupts HTML parsing to execute the JavaScript file.</p>



<p><strong>Deferred Loading:</strong></p>



<p><code>&lt;script src="jspath/to.js" deferred&gt;&lt;/script&gt;</code></p>



<p>Deferred scripts operate similarly to asynchronous ones, but they postpone parsing until after the HTML is fully parsed. Unlike asynchronous scripts, deferred scripts ensure loading in the order of declaration, akin to synchronous scripts.</p>



<p><strong>&lt;noscript&gt; Element:</strong></p>



<p><code>&lt;noscript&gt;JavaScript is disabled&lt;/noscript&gt;</code></p>



<p>The <strong>&lt;noscript&gt;</strong> element provides content to display if the user disables scripts or if the browser doesn&#8217;t support script usage. It can be positioned within either the <strong>&lt;head&gt;</strong> or the <strong>&lt;body&gt;</strong> section of the document.</p>



<h3 class="wp-block-heading" id="Incorporating-External-CSS-Stylesheets"><strong>Incorporating External CSS Stylesheets</strong></h3>



<p><code>&lt;link rel="stylesheet" href="csspath/to.css" type="text/css"&gt;</code></p>



<p>Conventionally, CSS <strong>&lt;link&gt;</strong> tags are positioned within the <strong>&lt;head&gt;</strong> tag at the outset of your HTML document. This arrangement ensures that CSS styles are loaded first, allowing them to apply to your page progressively. Thus, your page avoids displaying unstyled HTML content while waiting for the CSS to load. The type attribute is generally redundant in HTML5, as HTML5 inherently supports CSS.</p>



<p><code>&lt;link rel="stylesheet" href="csspath/to.css" type="text/css"&gt; &lt;link rel="stylesheet" href="csspath/to.css"&gt;</code></p>



<p>Both of these <strong>&lt;link&gt;</strong> tags achieve the same result in HTML5, with or without the type attribute.</p>



<p>Alternatively, a less common practice involves using the<strong> @import</strong> statement within direct CSS:</p>



<p><code>&lt;style type="text/css"&gt; @import("jspath/to.css") &lt;/style&gt; &lt;style&gt; @import("jspath/to.css") &lt;/style&gt;</code></p>



<h3 class="wp-block-heading" id="Managing-Favicon"><strong>Managing Favicon</strong></h3>



<p><code>&lt;link rel="icon" type="image/png" href="/favicon.png"&gt; &lt;link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"&gt;</code></p>



<p>For favicon management, specify image/png for PNG files and image/x-icon for icon (*.ico) files. The presence of a file named favicon.ico at the root of your website typically results in automatic loading and application without the need for a <strong>&lt;link&gt;</strong> tag. However, it&#8217;s worth noting that browsers may be sluggish and resistant to updating their cache if this file undergoes changes.</p>



<h3 class="wp-block-heading" id="Implementing-Alternative-CSS-Stylesheets"><strong>Implementing Alternative CSS Stylesheets</strong></h3>



<p><code>&lt;link rel="alternate stylesheet" href="csspath/to/style.css" title="Title"&gt;</code></p>



<p>Certain browsers offer support for alternate style sheets if they are provided. By default, these alternate stylesheets remain inactive but can be activated through browser settings:</p>



<ul class="wp-block-list">
<li>Firefox allows users to select the stylesheet via the View > Page Style submenu.</li>



<li>Internet Explorer supports this feature from version 8, accessible through View > Page Style (as of IE 11).</li>



<li>Chrome requires an extension to utilize this feature (as of version 48). Alternatively, the webpage itself can offer a user interface to enable users to switch between styles.<br>(Source: the MDN Docs)</li>
</ul>



<h3 class="wp-block-heading" id="Utilizing-Resource-Hinting-Attributes"><strong>Utilizing Resource Hinting Attributes</strong></h3>



<p><code><em>&lt;!-- Preconnect --&gt;</em> &lt;link rel="preconnect" href="URL"&gt; <em>&lt;!-- DNS-Prefetch --&gt;</em> &lt;link rel="dns-prefetch" href="URL"&gt; <em>&lt;!-- Prefetch --&gt;</em> &lt;link rel="prefetch" href="URL"&gt; <em>&lt;!-- Prerender --&gt;</em> &lt;link rel="prerender" href="URL"&gt;</code></p>



<p>These attributes serve different purposes:</p>



<ul class="wp-block-list">
<li><strong>Preconnect </strong>resolves DNS and initiates a TCP handshake and optional TLS negotiation.</li>



<li><strong>DNS-Prefetch</strong> instructs browsers to resolve the DNS for a URL, enhancing the loading speed of assets from that URL.</li>



<li><strong>Prefetch</strong> advises browsers to prefetch a specified resource for quicker loading.</li>



<li><strong>Prerender</strong> prompts browsers to fetch and render the URL in the background, allowing for instantaneous delivery to the user upon navigation to that URL. Note that Prerender is an experimental feature.</li>
</ul>



<h3 class="wp-block-heading" id="Managing-the-Link-'media'-Attribute"><strong>Managing the Link &#8216;media&#8217; Attribute</strong></h3>



<p><code>&lt;link rel="stylesheet" href="file.css" media="print"&gt;</code></p>



<p>The media attribute specifies which style sheet should be applied for a specific type of media. Setting the value to &#8220;print&#8221; ensures that the style sheet is only applied when printing pages. The attribute can accept various media type values, akin to a CSS media query.</p>



<h3 class="wp-block-heading" id="Implementing-Prev-and-Next-Links"><strong>Implementing Prev and Next Links</strong></h3>



<p><code><em>&lt;!-- Prev and Next Links --&gt;</em> &lt;link rel="prev" href="&lt;http://abc.com/page1&gt;"&gt; &lt;link rel="next" href="&lt;http://abc.com/page2&gt;"&gt;</code></p>



<p>In cases where a page forms part of a series of articles, the prev and next attributes can be used to link to preceding and succeeding pages.</p>



<h3 class="wp-block-heading" id="Enabling-Web-Feed-Discovery"><strong>Enabling Web Feed Discovery</strong></h3>



<p><code><em>&lt;!-- Web Feed Discovery --&gt;</em> <em>&lt;!-- Use the rel="alternate" attribute to facilitate the discoverability of Atom/RSS feeds. --&gt;</em> &lt;link rel="alternate" type="application/atom+xml" href="&lt;http://abc.com/feed.xml&gt;" /&gt; &lt;link rel="alternate" type="application/rss+xml" href="&lt;http://abc.com/feed.xml&gt;" /&gt;</code></p>



<p>These <strong>&lt;link&gt;</strong> tags enable the discovery of Atom/RSS feeds, providing alternative feed formats for the website.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dularsharma.com/chapter-12-resource-linking/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Chapter 11. Data Attributes</title>
		<link>https://www.dularsharma.com/chapter-11-data-attributes/</link>
					<comments>https://www.dularsharma.com/chapter-11-data-attributes/#respond</comments>
		
		<dc:creator><![CDATA[Dular Sharma]]></dc:creator>
		<pubDate>Thu, 30 Apr 2020 13:41:00 +0000</pubDate>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://www.dularsharma.com/?p=5752</guid>

					<description><![CDATA[128 Views Created by&#160;Dhruv Mahant Last updated:&#160;yesterday at 4:51 PM 1 min readSee how many people viewed this page Value Description somevalue entry denotes the purpose of the attribute, specifying its value as a string. Compatibility with Older Browsers: Data attributes were introduced with HTML5, a standard widely supported by modern browsers. However, older browsers [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 128</span><span class='epvc-label'> Views</span></div>
<ul class="wp-block-list">
<li><img decoding="async" src="https://4itsol.atlassian.net/wiki/aa-avatar/712020:35ff7ada-b1ec-4d5e-8c4f-89600e035730" alt=""></li>
</ul>



<p>Created by&nbsp;<a href="https://4itsol.atlassian.net/wiki/people/712020:35ff7ada-b1ec-4d5e-8c4f-89600e035730?ref=confluence&amp;src=profilecard" target="_blank" rel="noreferrer noopener">Dhruv Mahant</a></p>



<p>Last updated:&nbsp;<a href="https://4itsol.atlassian.net/wiki/pages/diffpagesbyversion.action?pageId=8847395&amp;selectedPageVersions=1&amp;selectedPageVersions=2">yesterday at 4:51 PM</a></p>



<p>1 min readSee how many people viewed this page</p>



<figure class="wp-block-table"><table><tbody><tr><th><strong>Value</strong></th><th><strong>Description</strong></th></tr><tr><td>somevalue</td><td>entry denotes the purpose of the attribute, specifying its value as a string.</td></tr></tbody></table></figure>



<h3 class="wp-block-heading" id="Compatibility-with-Older-Browsers:"><strong>Compatibility with Older Browsers:</strong></h3>



<p>Data attributes were introduced with HTML5, a standard widely supported by modern browsers. However, older browsers predating HTML5 do not recognize these data attributes.</p>



<p>According to HTML specifications, attributes unrecognized by the browser should be left untouched, and the browser will simply disregard them during page rendering.</p>



<p>Web developers have leveraged this aspect to create non-standard attributes, which are attributes not defined in HTML specifications. For instance, consider the <code>value</code> attribute in the following <code>&lt;img&gt;</code> tag:</p>



<p><code>&lt;img src="img.jpg" value="imgValue" /&gt;</code></p>



<p>Since the <code>&lt;img&gt;</code> tag specifications do not include a <code>value</code> attribute, and it&#8217;s not a global attribute, <code>value</code> is considered a non-standard attribute.</p>



<p>Despite the lack of support in older browsers, data attributes still function as intended. You can both set and retrieve them using generic JavaScript methods like <code>setAttribute</code> and <code>getAttribute</code>. However, the newer <code>dataset</code> property, available in modern browsers, cannot be utilized in older ones.</p>



<h3 class="wp-block-heading" id="Use-Of-Data-Attributes:"><strong>Use Of Data Attributes:</strong></h3>



<p>You can create custom data attributes in HTML5 using the <strong>data-*</strong> syntax. These attributes provide a handy way to store data within HTML elements, which can then be accessed and manipulated using JavaScript. For instance:</p>



<p><code>&lt;div data-submitted="yes" class="class1"&gt; ... content ... &lt;/div&gt;</code></p>



<p>In this example, we&#8217;ve assigned a custom data attribute <code>data-submitted</code> with a value of <code>"yes"</code> to a <code>&lt;div&gt;</code> element with the class <code>class1</code>. The <code>data-*</code> structure allows you to name the attribute after the <code>data-</code> part, making it accessible for retrieval or modification via JavaScript.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dularsharma.com/chapter-11-data-attributes/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Chapter 10. IDs and Classes</title>
		<link>https://www.dularsharma.com/chapter-10-ids-and-classes/</link>
					<comments>https://www.dularsharma.com/chapter-10-ids-and-classes/#respond</comments>
		
		<dc:creator><![CDATA[Dular Sharma]]></dc:creator>
		<pubDate>Wed, 29 Apr 2020 13:38:00 +0000</pubDate>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://www.dularsharma.com/?p=5750</guid>

					<description><![CDATA[133 Views Parameter Details class Indicates the class of the element (non-unique). id Indicates the ID of the element (unique in the same context). Classes and IDs simplify referencing HTML elements from scripts and stylesheets. The class attribute can be applied to one or more tags and is utilized by CSS for styling. However, IDs [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 133</span><span class='epvc-label'> Views</span></div>
<figure class="wp-block-table"><table><tbody><tr><th>Parameter</th><th>Details</th></tr><tr><td><strong>class</strong></td><td>Indicates the class of the element (non-unique).</td></tr><tr><td><strong>id</strong></td><td>Indicates the ID of the element (unique in the same context).</td></tr></tbody></table></figure>



<p>Classes and IDs simplify referencing HTML elements from scripts and stylesheets. The <code>class</code> attribute can be applied to one or more tags and is utilized by CSS for styling. However, IDs are intended to uniquely identify a single element, thus the same ID should not be reused. IDs are commonly used with JavaScript and internal document links, but their usage in CSS is discouraged.</p>



<h2 class="wp-block-heading" id="Assigning-a-Class-to-an-Element"><strong>Assigning a Class to an Element</strong></h2>



<p>Classes serve as identifiers for the elements they are assigned to. Use the <code>class</code> attribute to assign a class to an element:</p>



<p><code>&lt;div class="class1"&gt;&lt;/div&gt;</code></p>



<p>To assign multiple classes to an element, separate the class names with spaces:</p>



<p><code>&lt;div class="class1 class2"&gt;&lt;/div&gt;</code></p>



<p>Utilizing classes in CSS enables styling specific elements without affecting all elements of the same type. For instance, the following <code>&lt;span&gt;</code> elements can have distinct stylings:</p>



<p><code>&lt;span&gt;&lt;/span&gt; &lt;span class="class1"&gt;&lt;/span&gt;</code></p>



<p>Elements with the same class name can be styled uniformly across the page, unless specified otherwise in the CSS:</p>



<p><code>&lt;div class="class1"&gt;This is class 1&lt;/div&gt; &lt;span class="class1"&gt;This is class 1&lt;/span&gt;</code></p>



<p>However, if targeting only <code>&lt;div&gt;</code> elements with the class <code>class1</code>, specificity can be added in the CSS:</p>



<p><code>div.class1 { color: red; }</code></p>



<p>It&#8217;s generally recommended to utilize only classes (e.g., <code>.class1</code>) rather than elements with classes (e.g., <code>div.class1</code>) when styling with CSS. Classes can also be nested in CSS selectors, such as:</p>



<p><code>.class1 .class2 { color: green; } <em>/* Descendant combinator */</em> .class1 &gt; .class2 { color: yellow; } <em>/* Child combinator */</em></code></p>



<p>Additionally, you can chain class selectors to select elements with a combination of several classes.</p>



<p>You have the option to chain the class selector to exclusively target elements that possess a combination of multiple classes. Consider the following HTML scenario:</p>



<p><code>&lt;div class="class1 class2 class3"&gt;This text will be red&lt;/div&gt;</code></p>



<p>Suppose we aim to make this particular text appear pink. In such cases, we can employ the following CSS approach:</p>



<p><code>.class1.class2.class3 { color: red; }</code></p>



<h3 class="wp-block-heading" id="Assigning-an-ID-to-an-Element"><strong>Assigning an ID to an Element</strong></h3>



<p>The <code>ID</code> attribute of an element serves as a unique identifier within the entire document. Its purpose is to uniquely identify the element for linking, scripting, or styling purposes.</p>



<p><code>&lt;div id="id1"&gt;&lt;/div&gt;</code></p>



<p>Avoid having two elements with the same ID in the same document, as it may lead to unexpected behavior when styling with CSS or adding functionality with JavaScript.</p>



<p>To reference elements by their ID in CSS, prefix the ID with <code>#</code>:</p>



<p><code>#id1 { color: red; }</code></p>



<p>To navigate to an element with an ID on a page, append <code>#</code> followed by the element name in the URL:</p>



<p><code>&lt;http://abc.com/about#id1&gt;</code></p>



<p>This feature is widely supported in browsers and doesn&#8217;t require additional JavaScript or CSS to function.</p>



<h3 class="wp-block-heading" id="Acceptable-Values"><strong>Acceptable Values</strong></h3>



<p><strong>For an ID (Version ≥ 5)</strong></p>



<p>The value of an ID must be unique in the document, cannot contain spaces, and must contain at least one character. Therefore, the value can include digits, punctuation characters, special characters, etc., but not whitespace.</p>



<p>Valid examples:</p>



<p><code>&lt;div id="id1"&gt; ... &lt;/div&gt; &lt;div id="111"&gt; ... &lt;/div&gt; &lt;div id="#%a;sdm-||"&gt; ... &lt;/div&gt; &lt;div id="____b"&gt; ... &lt;/div&gt;</code></p>



<p>Invalid examples:</p>



<p><code>&lt;div id=" "&gt; ... &lt;/div&gt; &lt;div id="id1"&gt; ... &lt;/div&gt; <em>&lt;!-- Duplicate IDs --&gt;</em></code></p>



<p><strong>The ID value should commence with a letter and may then be followed by:</strong></p>



<ul class="wp-block-list">
<li>Letters (A-Z/a-z)</li>



<li>Digits (0-9)</li>



<li>Hyphens (&#8220;-&#8220;)</li>



<li>Underscores (&#8220;_&#8221;)</li>



<li>Colons (&#8220;:&#8221;)</li>



<li>Periods (&#8220;.&#8221;)</li>
</ul>



<p>Looking at the initial examples provided in the HTML5 section, only one is considered valid:</p>



<p><code>&lt;div id="class1"&gt; ... &lt;/div&gt;</code></p>



<p>These formats are also acceptable:</p>



<p><code>&lt;div id="class1"&gt; ... &lt;/div&gt; &lt;div id="class-1"&gt; ... &lt;/div&gt; &lt;div id="class_1"&gt; ... &lt;/div&gt; &lt;div id="class:1"&gt; ... &lt;/div&gt; &lt;div id="class.1"&gt; ... &lt;/div&gt;</code></p>



<p>Remember, if the ID value does not commence with a letter (whether uppercase or lowercase), it is considered invalid.</p>



<p><strong>For a Class</strong></p>



<p>Classes follow similar rules to IDs but do not need to be unique in the document. While duplicate class names are acceptable, it&#8217;s crucial to avoid duplicate IDs.</p>



<h3 class="wp-block-heading" id="Important-Note:-Treatment-of-ID-and-Class-Values-Outside-of-HTML"><strong>Important Note: Treatment of ID and Class Values Outside of HTML</strong></h3>



<p>Be cautious when using numbers, punctuation, or special characters in ID or class values, as they may cause issues in other contexts such as CSS, JavaScript, and regular expressions.</p>



<p>For instance, while the following ID is valid in HTML5:</p>



<p><code>&lt;div id="1id"&gt; ... &lt;/div&gt;</code></p>



<p>It is invalid in CSS due to its restrictions on identifiers:</p>



<p>In most cases, you may need to escape characters in contexts with restrictions or special meanings.</p>



<h3 class="wp-block-heading" id="Issues-Related-to-Duplicate-IDs"><strong>Issues Related to Duplicate IDs</strong></h3>



<p>Having multiple elements with the same ID is a challenging problem to troubleshoot. While the HTML parser will attempt to render the page, it may lead to misbehavior in the web page.</p>



<p>For example:</p>



<p><code>&lt;div id="id1"&gt;a&lt;/div&gt; &lt;div id="id1"&gt;b&lt;/div&gt;</code></p>



<p>While CSS selectors will still work:</p>



<p><code>#id1 { color: green; }</code></p>



<p>JavaScript may fail to handle both elements:</p>



<p><code>var html = document.getElementById("id1").innerHTML;</code></p>



<p>In this scenario, the <code>html</code> variable will only contain the content of the first <code>&lt;div&gt;</code> (&#8220;i&#8221;).</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dularsharma.com/chapter-10-ids-and-classes/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Chapter 9. Comments</title>
		<link>https://www.dularsharma.com/chapter-9-comments/</link>
					<comments>https://www.dularsharma.com/chapter-9-comments/#respond</comments>
		
		<dc:creator><![CDATA[Dular Sharma]]></dc:creator>
		<pubDate>Tue, 28 Apr 2020 13:32:00 +0000</pubDate>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://www.dularsharma.com/?p=5747</guid>

					<description><![CDATA[138 Views Similar to other programming, markup, and markdown languages, HTML comments serve to provide developers with development-specific information without impacting the user interface. However, unlike some other languages, HTML comments can be utilized to target HTML elements specifically for Internet Explorer. This section elucidates the process of crafting HTML comments and their practical applications. [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 138</span><span class='epvc-label'> Views</span></div>
<p>Similar to other programming, markup, and markdown languages, HTML comments serve to provide developers with development-specific information without impacting the user interface. However, unlike some other languages, HTML comments can be utilized to target HTML elements specifically for Internet Explorer. This section elucidates the process of crafting HTML comments and their practical applications.</p>



<h3 class="wp-block-heading" id="Section-9.1.-Creating-Comments"><strong>Section 9.1. Creating Comments</strong></h3>



<p>HTML comments are effective for leaving annotations within the code for personal or collaborative reference. They are initiated with <code>&lt;!--</code> and concluded with <code>--&gt;</code>, as demonstrated below:</p>



<p><code><em>&lt;!-- I'm a comment! --&gt;</em></code></p>



<p>Comments can also be inserted inline within other content:</p>



<p><code>&lt;h1&gt;This is a Header <em>&lt;!-- This comment will not be displayed --&gt;</em>.&lt;/h1&gt;</code></p>



<p>For more elaborate notes, comments can span multiple lines:</p>



<p><code><em>&lt;!-- </em><em>This is a multiline comment. </em><em>Anything written in this section will not get displayed by browser. </em><em>--&gt;</em></code></p>



<p>However, it&#8217;s essential to note that comments cannot be placed within another HTML tag, as it would result in invalid HTML syntax:</p>



<p><code>&lt;h1 &lt;!-- comment --&gt;&gt;This will throw an error/h1&gt;</code></p>



<p>To maintain compatibility with tools parsing HTML as XML or SGML, it&#8217;s advised not to include two consecutive dashes <code>--</code> within the comment body.</p>



<h3 class="wp-block-heading" id="Section-9.2.-Commenting-out-Whitespace"><strong>Section 9.2. Commenting out Whitespace</strong></h3>



<p>Inline display elements, such as <code>&lt;span&gt;</code> or <code>&lt;a&gt;</code>, typically include up to one whitespace character before and after them in the document. To mitigate lengthy markup lines and unintentional whitespace, comments can be used to nullify whitespace characters:</p>



<p><code>&lt;a href="#"&gt;No extra space as we are using comments&lt;/a&gt;<em>&lt;!-- </em><em>--&gt;</em>&lt;button&gt;Button&lt;/button&gt;</code></p>



<p>Omitting the comment between inline elements results in an unintended space between them. In some cases, preserving the space character is necessary.</p>



<p><strong>Example code:</strong></p>



<p><code>&lt;a href="#"&gt;No extra space as we are using comments&lt;/a&gt;<em>&lt;!-- </em><em>--&gt;</em>&lt;button&gt;Button&lt;/button&gt; &lt;hr&gt; &lt;a href="#"&gt;Wxtra space as we are not using comments&lt;/a&gt; &lt;button&gt;Button&lt;/button&gt;</code></p>



<p><strong>Output:</strong></p>



<figure class="wp-block-image size-full"><img decoding="async" width="340" height="79" src="https://www.dularsharma.com/wp-content/uploads/2024/04/image-5.png" alt="" class="wp-image-5748" srcset="https://www.dularsharma.com/wp-content/uploads/2024/04/image-5.png 340w, https://www.dularsharma.com/wp-content/uploads/2024/04/image-5-300x70.png 300w" sizes="(max-width: 340px) 100vw, 340px" /></figure>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dularsharma.com/chapter-9-comments/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Chapter 8. Tables</title>
		<link>https://www.dularsharma.com/chapter-8-tables/</link>
					<comments>https://www.dularsharma.com/chapter-8-tables/#respond</comments>
		
		<dc:creator><![CDATA[Dular Sharma]]></dc:creator>
		<pubDate>Mon, 27 Apr 2020 13:27:00 +0000</pubDate>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://www.dularsharma.com/?p=5743</guid>

					<description><![CDATA[131 Views The &#60;table&#62; element in HTML empowers web creators to present tabular information, including text, images, links, and additional tables, in a structured format characterized by rows and columns of cells. Simple Table Format: &#60;table&#62; &#60;tr&#62; &#60;th&#62;Column 1, Row 1&#60;/th&#62; &#60;th&#62;Column 2, Row 1&#60;/th&#62; &#60;/tr&#62; &#60;tr&#62; &#60;td&#62; Column1, Row 2&#60;/td&#62; &#60;td&#62; Column2, Row 2&#60;/td&#62; [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 131</span><span class='epvc-label'> Views</span></div>
<p>The <strong>&lt;table&gt;</strong> element in HTML empowers web creators to present tabular information, including text, images, links, and additional tables, in a structured format characterized by rows and columns of cells.</p>



<h1 class="wp-block-heading" id="Simple-Table-Format:">Simple Table Format:</h1>



<p><code>&lt;table&gt; &lt;tr&gt; &lt;th&gt;Column 1, Row 1&lt;/th&gt; &lt;th&gt;Column 2, Row 1&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; Column1, Row 2&lt;/td&gt; &lt;td&gt; Column2, Row 2&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; Column1, Row 3&lt;/td&gt; &lt;td&gt; Column2, Row 3&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;</code></p>



<p>The code snippet will generate a &lt;table&gt; comprising three rows in total <strong>(&lt;tr&gt;):</strong> one row containing header cells <strong>(&lt;th&gt;)</strong>, and two rows containing content cells<strong> (&lt;td&gt;). &lt;th&gt;</strong> elements serve as tabular headers, while <strong>&lt;td&gt;</strong> elements represent tabular data. You have the flexibility to include any desired content within <strong>&lt;td&gt;</strong> or <strong>&lt;th&gt;</strong> elements.</p>



<p><strong>Example table layout:</strong></p>



<figure class="wp-block-image size-full"><img decoding="async" width="256" height="70" src="https://www.dularsharma.com/wp-content/uploads/2024/04/image-3.png" alt="" class="wp-image-5744"/></figure>



<h1 class="wp-block-heading" id="Spanning:">Spanning:</h1>



<p>You can extend the span of table cells across multiple columns or rows by utilizing the <strong>colspan </strong>and <strong>rowspan </strong>attributes, which can be applied to both <strong>&lt;th&gt;</strong> and <strong>&lt;td&gt;</strong> elements.</p>



<p><code>table&gt; &lt;tr&gt; &lt;th&gt;Column 1, Row 1&lt;/th&gt; &lt;th&gt;Column 2, Row 1&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="2"&gt; Column1, Row 2&lt;/td&gt; &lt;td&gt; Column2, Row 2&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td rowspan="2"&gt; Column 1, Row 3 - Spanned Across Two Rows&lt;/td&gt; &lt;td&gt; Column2, Row 3&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;column 1, Row 4&lt;/td&gt; &lt;td&gt;column 2, Row 4&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;</code></p>



<p><strong>Output:</strong></p>



<figure class="wp-block-table"><table><tbody><tr><td>Column 1, Row 1</td><td>Column 2, Row 1</td><td>&nbsp;</td></tr><tr><td colspan="2">Column 1, Row 2</td><td>Column 2, Row 2</td></tr><tr><td rowspan="2">Column 1, Row 3 &#8211; Spanned Across Two Rows</td><td>Column 2, Row 3</td><td>&nbsp;</td></tr><tr><td>Column 1, Row 4</td><td>Column 2, Row 4</td></tr></tbody></table></figure>



<p>Note: It&#8217;s important to avoid designing tables where rows and columns overlap, as this violates HTML standards and may produce inconsistent rendering across different web browsers.</p>



<p><strong>Explanation of attributes:</strong></p>



<ul class="wp-block-list">
<li><strong>rowspan</strong>: Specifies the number of rows spanned by a cell. Default is 1, and 0 means it spans to the last row of the table section (<strong>&lt;thead>, &lt;tbody>, or &lt;tfoot></strong>).</li>



<li><strong>colspan</strong>: Specifies the number of columns spanned by the current cell. Default is 1, and 0 means it extends to the last column of the <strong>&lt;colgroup></strong> in which the cell is defined.</li>
</ul>



<h1 class="wp-block-heading" id="Column-Groups:">Column Groups:</h1>



<p>At times, you might find it necessary to style a column or a group of columns, or to logically group columns for semantic clarity. For such purposes, HTML provides the <strong>&lt;colgroup&gt;</strong> and <strong>&lt;col&gt;</strong> elements.</p>



<p>The <strong>&lt;colgroup&gt;</strong> tag, which is optional, enables you to group columns together. It should be nested within a &lt;table&gt; element, positioned after any &lt;caption&gt; elements, and before any table content (e.g., <strong>&lt;tr&gt;, &lt;thead&gt;, &lt;tbody&gt;</strong>, etc.).</p>



<p>Example usage of <strong>&lt;colgroup&gt;</strong>:</p>



<p><code>&lt;table&gt; &lt;colgroup span="3"&gt;&lt;/colgroup&gt; &lt;colgroup span="2"&gt;&lt;/colgroup&gt; &lt;/table&gt;</code></p>



<p>On the other hand, the <strong>&lt;col&gt; </strong>tag is optional and allows you to target individual columns or a range of columns without applying logical grouping. If used, &lt;col&gt; elements must be placed within a <strong>&lt;colgroup&gt; </strong>element.</p>



<p>Example usage of <strong>&lt;col&gt;</strong>:</p>



<p><code>&lt;table&gt; &lt;colgroup&gt; &lt;col id="id1" /&gt; &lt;col /&gt; &lt;/colgroup&gt; &lt;colgroup&gt; &lt;col class="class 1" /&gt; &lt;col class="class 2" span="2" /&gt; &lt;/colgroup&gt; <em>&lt;!-- More colgroup elements with col elements can be added here --&gt;</em> &lt;/table&gt;</code></p>



<p>CSS styles such as <strong>border, background, width, visibility, and display (including display: none) </strong>can be applied to both <strong>&lt;colgroup&gt;</strong> and <strong>&lt;col&gt;</strong> elements. Utilizing display: none will effectively remove the specified columns from display, causing the table to render as if those cells do not exist.</p>



<h1 class="wp-block-heading" id="Table-with-head,-body,-foot-and-caption">Table with head, body, foot and caption</h1>



<p>HTML offers additional elements such as <strong>&lt;thead&gt;, &lt;tbody&gt;, &lt;tfoot&gt;</strong>, and <strong>&lt;caption&gt;</strong> to enhance the semantic structure of tables and facilitate separate CSS styling. These elements play a crucial role in organizing and styling tabular data effectively.</p>



<p>When printing a table that spans multiple pages, most browsers repeat the contents of &lt;thead&gt; on each page, ensuring clarity and continuity.</p>



<p>It&#8217;s essential to follow a specific order while structuring tables with these elements. However, not every element behaves intuitively within this structure. The following example illustrates the correct placement of these elements:</p>



<p><code>&lt;table&gt; &lt;caption&gt;Title Of The Table&lt;/caption&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Header 1&lt;/th&gt; &lt;th&gt;Header 2&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;Body Text 1&lt;/td&gt; &lt;td&gt;Body Text 2&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;tfoot&gt; &lt;tr&gt; &lt;td&gt;Footer Text 1&lt;/td&gt; &lt;td&gt;Footer Text 2&lt;/td&gt; &lt;/tr&gt; &lt;/tfoot&gt; &lt;/table&gt;</code></p>



<p>The example below demonstrates two renditions of the table: one without any styling and the other with CSS properties applied for illustration purposes. These styles include background-color, color, and border. While these styles are provided as a visual aid, they are not integral to understanding the table structure.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="200" height="104" src="https://www.dularsharma.com/wp-content/uploads/2024/04/image-4.png" alt="" class="wp-image-5745"/></figure>
</div>


<p><strong>Styling details:</strong></p>



<ul class="wp-block-list">
<li><strong>&lt;caption></strong>: White text on a black background.</li>



<li><strong>&lt;thead></strong>: Bold text on a blue background.</li>



<li><strong>&lt;tbody></strong>: Text on a pink background.</li>



<li><strong>&lt;tfoot></strong>: Text on a red background.</li>



<li><strong>&lt;th></strong>: Black borders.</li>



<li><strong>&lt;td></strong>: Green borders.</li>
</ul>



<h1 class="wp-block-heading" id="Heading-Scope">Heading Scope</h1>



<p>The <strong>&lt;th&gt; </strong>elements are commonly used to designate headings for table rows and columns, enhancing table readability. Here&#8217;s an example:</p>



<p><code>&lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;th&gt;Column 1&lt;/th&gt; &lt;th&gt;Column 2&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th&gt;Row 1&lt;/th&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;th&gt;Row 2&lt;/th&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;</code></p>



<p>To enhance accessibility, you can utilize the scope attribute. Here&#8217;s the improved version with the scope attribute:</p>



<p><code>&lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;th scope="col"&gt;Column 1&lt;/th&gt; &lt;th scope="col"&gt;Column 2&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th scope="row"&gt;Row 1&lt;/th&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;th scope="row"&gt;RoW 2&lt;/th&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;</code></p>



<p>The scope attribute is an enumerated attribute, meaning it can have a value from a specific set. This set includes:</p>



<ul class="wp-block-list">
<li><strong>col</strong></li>



<li><strong>row</strong></li>



<li><strong>colgroup</strong></li>



<li><strong>rowgroup</strong></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dularsharma.com/chapter-8-tables/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Chapter 7: Lists</title>
		<link>https://www.dularsharma.com/chapter-7-lists/</link>
					<comments>https://www.dularsharma.com/chapter-7-lists/#respond</comments>
		
		<dc:creator><![CDATA[Dular Sharma]]></dc:creator>
		<pubDate>Sun, 26 Apr 2020 13:26:00 +0000</pubDate>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://www.dularsharma.com/?p=5741</guid>

					<description><![CDATA[139 Views HTML provides three methods for defining lists: ordered lists, unordered lists, and description lists. Ordered lists utilize ordinal sequences to signify the order of list items, unordered lists employ symbols like bullets to present items in no specific order, and description lists use indentation to display items alongside their descriptions. This topic elucidates [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 139</span><span class='epvc-label'> Views</span></div>
<p>HTML provides three methods for defining lists: ordered lists, unordered lists, and description lists. Ordered lists utilize ordinal sequences to signify the order of list items, unordered lists employ symbols like bullets to present items in no specific order, and description lists use indentation to display items alongside their descriptions. This topic elucidates the utilization and amalgamation of these list types within HTML markup.</p>



<h3 class="wp-block-heading" id="Ordered-List:">Ordered List:</h3>



<p>You can create an ordered list using the <code>&lt;ol&gt;</code> tag, and each list item can be defined with the <code>&lt;li&gt;</code> tag, as demonstrated below:</p>



<p><code>&lt;ol&gt; &lt;li&gt;Item 1&lt;/li&gt; &lt;li&gt;Item 2&lt;/li&gt; &lt;li&gt;Item 3&lt;/li&gt; &lt;/ol&gt;</code></p>



<p>This code will generate a numbered list, which is the default style:</p>



<ol class="wp-block-list" start="1">
<li><strong>Item 1</strong></li>



<li><strong>Item 2</strong></li>



<li><strong>Item 3</strong></li>
</ol>



<p><strong>Manual Number Manipulation:</strong></p>



<p>There are several ways to manipulate the numbering of list items in an ordered list. One method is to specify a starting number using the <code>start</code> attribute. The list will commence at this specified number and continue incrementing by one as usual.</p>



<p><code>&lt;ol start="3"&gt; &lt;li&gt; Item 1&lt;/li&gt; &lt;li&gt; Item 2&lt;/li&gt; &lt;li&gt; Item 3&lt;/li&gt; &lt;/ol&gt;</code></p>



<p>This will result in a numbered list, starting from the defined number:</p>



<ol class="wp-block-list" start="3">
<li><strong>Item 1</strong></li>



<li><strong>Item 2</strong></li>



<li><strong>Item 3</strong></li>
</ol>



<p>You can also explicitly assign a particular number to a specific list item. Subsequent list items after one with a specified value will continue counting from that item&#8217;s value, disregarding the numbering of the parent list.</p>



<p><code>&lt;li value="3"&gt;&lt;/li&gt;</code></p>



<p>It&#8217;s important to note that by using the <code>value</code> attribute directly on a list item, you can reset an ordered list&#8217;s numbering system by starting the numbering from a lower value. For instance, if the parent list had reached value 6 and encountered a list item at value 3, that item would display as 1 and resume counting from that point onward.</p>



<p><code>ol start="3"&gt; &lt;li&gt; Item 1&lt;/li&gt; &lt;li&gt; Item 2&lt;/li&gt; &lt;li value="1"&gt; Item 3&lt;/li&gt; &lt;li&gt; Item 3&lt;/li&gt; &lt;li&gt; Item 3&lt;/li&gt; &lt;li&gt; Item 3&lt;/li&gt; &lt;/ol&gt;</code></p>



<p>In the example above, the list follows the sequence <strong>3,4,1,2,3,4</strong>&#8211; restarting from a lower number than before and duplicating the number 6 in the list.</p>



<p>Note: The <code>start</code> and <code>value</code> attributes only accept numerical values, even if the ordered list is configured to display Roman numerals or letters.</p>



<p>Version ≥ 5: You can reverse the numbering by adding <code>reversed</code> in your <code>&lt;ol&gt;</code> element:</p>



<p><code>&lt;ol reversed&gt; &lt;li&gt; Item 1&lt;/li&gt; &lt;li&gt; Item 2&lt;/li&gt; &lt;li value="1"&gt; Item 3&lt;/li&gt; &lt;li&gt; Item 3&lt;/li&gt; &lt;li&gt; Item 3&lt;/li&gt; &lt;li&gt; Item 3&lt;/li&gt; &lt;/ol&gt;</code></p>



<p>Reverse numbering is useful for lists where new items are continuously added, such as podcast episodes or presentations, and you want the most recent items to appear first.</p>



<p><strong>Changing the Numeral Type:</strong></p>



<p>You can easily alter the type of numeral displayed in the list item marker by using the <code>type</code> attribute:</p>



<p><code>&lt;ol type="1|a|A|i|I"&gt;</code></p>



<p>Here are the descriptions and examples of different types:</p>



<figure class="wp-block-table"><table><tbody><tr><th><strong>Type</strong></th><th><strong>Description</strong></th><th><strong>Example</strong></th></tr><tr><td>1</td><td>Default</td><td>1,2,3,4</td></tr><tr><td>a</td><td>Alphabetical (lowercase)</td><td>a,b,c,d</td></tr><tr><td>A</td><td>Alphabetical (Uppercase)</td><td>A.B.C.D</td></tr><tr><td>i</td><td>Roman Numerals (Lowercase)</td><td>i, ii, iii, iv</td></tr><tr><td>I</td><td>Roman Numerals (Uppercase)</td><td>I, II, III, IV</td></tr></tbody></table></figure>



<p>You should use <code>&lt;ol&gt;</code> to display a list of items where intentional ordering is emphasized. If changing the order of the items does not affect the correctness of the list, you should use <code>&lt;ul&gt;</code>.</p>



<h3 class="wp-block-heading" id="Unordered-List:"><strong>Unordered List:</strong></h3>



<p>You can create an unordered list using the <code>&lt;ul&gt;</code> tag, and each list item can be defined with the <code>&lt;li&gt;</code> tag, as illustrated below:</p>



<p><code>&lt;ul&gt; &lt;li&gt; Item 1&lt;/li&gt; &lt;li&gt; Item 2&lt;/li&gt; &lt;li&gt; Item 3&lt;/li&gt; &lt;/ul&gt;</code></p>



<p>This code will generate a bulleted list, which is the default style:</p>



<ul class="wp-block-list">
<li><strong>Item 1</strong></li>



<li><strong>Item 2</strong></li>



<li><strong>Item 3</strong></li>
</ul>



<p>You should utilize <code>&lt;ul&gt;</code> to display a list of items where the order is not significant. If changing the order of the items would render the list incorrect, you should opt for <code>&lt;ol&gt;</code>.</p>



<h3 class="wp-block-heading" id="Nested-Lists:"><strong>Nested Lists:</strong></h3>



<p>You have the flexibility to nest lists to depict sub-items within a list item. For example:</p>



<p><code>&lt;ul&gt; &lt;li&gt; Item 1&lt;/li&gt; &lt;li&gt; Item 2&lt;/li&gt; &lt;li&gt; Item 3 &lt;ul&gt; Item 3.1&lt;/ul&gt; &lt;ul&gt; Item 3.2&lt;/ul&gt; &lt;/li&gt; &lt;li&gt; Item 4&lt;/li&gt; &lt;/ul&gt;</code></p>



<p>This markup will render as:</p>



<ul class="wp-block-list">
<li><strong>Item 1</strong></li>



<li><strong>Item 2</strong></li>



<li><strong>Item 3</strong>
<ul class="wp-block-list">
<li><strong>Item 3.1</strong></li>



<li><strong>Item 3.2</strong></li>
</ul>
</li>



<li><strong>Item 4</strong></li>
</ul>



<p>It&#8217;s important to note that the nested list must be a descendant of the <code>&lt;li&gt;</code> element.</p>



<p>Additionally, you can nest different types of lists. For instance:</p>



<p><code>&lt;ol&gt; &lt;li&gt; Item 1&lt;/li&gt; &lt;li&gt; Item 2&lt;/li&gt; &lt;li&gt; Item 3 &lt;ul&gt; Item 3.1&lt;/ul&gt; &lt;ul&gt; Item 3.2&lt;/ul&gt; &lt;/li&gt; &lt;li&gt; Item 4&lt;/li&gt; &lt;/ol&gt;</code></p>



<h3 class="wp-block-heading" id="Description-list">Description list</h3>



<p>You can utilize the <code>&lt;dl&gt;</code> element to create a description list, formerly known as a definition list prior to HTML5. It comprises name-value pairs, where the name is specified within the <code>&lt;dl&gt;</code> element, and the corresponding value is provided within the <code>&lt;dd&gt;</code> element.</p>



<p><code>&lt;dl&gt; &lt;dt&gt;Name Of Item 1&lt;/dt&gt; &lt;dd&gt;value for Item 1&lt;/dd&gt; &lt;dt&gt;Name Of Item 1&lt;/dt&gt; &lt;dd&gt;value for Item 2&lt;/dd&gt; &lt;/dl&gt;</code></p>



<p>Here&#8217;s an example of a name-value group with multiple names and/or values:</p>



<p><code>dl&gt; &lt;dt&gt;Name Of Item 1&lt;/dt&gt; &lt;dt&gt;Name Of Item 2&lt;/dt&gt; &lt;dd&gt;value for Item 1 and Item 2&lt;/dd&gt; &lt;dt&gt;Name Of Item 3&lt;/dt&gt; &lt;dd&gt;value for Item 3&lt;/dd&gt; &lt;dd&gt;value for Item 3&lt;/dd&gt; &lt;/dl&gt;</code></p>



<p>This arrangement allows for clear delineation and presentation of associated name-value pairs.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dularsharma.com/chapter-7-lists/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
