{"id":3614,"date":"2020-01-10T14:00:00","date_gmt":"2020-01-10T14:00:00","guid":{"rendered":"https:\/\/azoora.com\/blog\/?p=3614"},"modified":"2020-01-14T04:21:45","modified_gmt":"2020-01-14T04:21:45","slug":"html-tags-uses-best-practices","status":"publish","type":"post","link":"https:\/\/azoora.com\/blog\/information\/html-tags-uses-best-practices\/","title":{"rendered":"HTML Tags: Uses &#038; Best Practices"},"content":{"rendered":"\n<p>The introduction of the HTML5 specification brought with it a host of new semantic tags, giving more meaning to HTML tags. This meant that web designers no longer needed to produce swatches of &lt;div> tags to build their site structure.<br><br>The basic semantic\u00a0HTML tags\u00a0such as\u00a0<strong>&lt;header><\/strong>,\u00a0<strong>&lt;footer><\/strong>\u00a0and\u00a0<strong>&lt;nav><\/strong>\u00a0are almost self explanatory. But, there are a host of newer HTML tags that web designers need to be using as well. Here we pick eight HTML tags that you should be using right now and briefly explain how they should be used. Plus, you&#8217;ll find five HTML tags that need to be replaced immediately if you are still using them.\u00a0<\/p>\n\n\n\n<h3 id=\"01-lt-picture-gt-xa0\">01. &lt;picture><\/h3>\n\n\n\n<p>The&nbsp;<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/picture\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>&lt;picture&gt;<\/strong><\/a>&nbsp;tag is similar to&nbsp;<strong>&lt;img&gt;<\/strong>, the&nbsp;<strong>&lt;picture&gt;<\/strong>&nbsp;element provides flexibility by allowing multiple&nbsp;<strong>&lt;source&gt;<\/strong>&nbsp;elements for the same resource, which can adapt based on a media query or image type support. For example, it can supply WebP images to browsers that support the newer, smaller file size.<\/p>\n\n\n\n<h3 id=\"02-lt-datalist-gt\">02. &lt;datalist&gt;<\/h3>\n\n\n\n<p>The&nbsp;<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/datalist\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>&lt;datalist&gt;<\/strong><\/a>&nbsp;tag provides an autocomplete interface for&nbsp;<strong>&lt;input&gt;<\/strong>&nbsp;elements. Each list contains a set of&nbsp;<strong>&lt;option&gt;<\/strong>&nbsp;elements that have an associated value. When linked to an&nbsp;<strong>&lt;input&gt;<\/strong>&nbsp;using the \u201clist\u201d attribute, it can provide a drop-down list or even display suggestions as the user types.<\/p>\n\n\n\n<h3 id=\"03-lt-dl-gt-xa0\">03. &lt;dl&gt;&nbsp;<\/h3>\n\n\n\n<p>This description list, or&nbsp;<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/dl\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>&lt;dl&gt;<\/strong><\/a>&nbsp;tag, element serves as a container for groups of defined terms. Inside, each term (<strong>&lt;dt&gt;<\/strong>) and definition (<strong>&lt;dd&gt;<\/strong>) are grouped together to form a glossary-like structure. While it applies basic formatting by default, semantic HTML benefits screen readers and other automated tools such as crawlers.<\/p>\n\n\n\n<h3 id=\"04-lt-details-gt-xa0\">04. &lt;details&gt;&nbsp;<\/h3>\n\n\n\n<p>Accordions are a common design pattern when lots of data needs to be shown at once, such as a questions page. By using the&nbsp;<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/details\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>&lt;details&gt;<\/strong><\/a>&nbsp;element alongside&nbsp;<strong>&lt;summary&gt;<\/strong>, we can achieve the same effect without JavaScript. Clicking the summary will toggle the rest of the content.<\/p>\n\n\n\n<h3 id=\"05-lt-dfn-gt-xa0\">05. &lt;dfn&gt;&nbsp;<\/h3>\n\n\n\n<p>Complex terms or abbreviations often need defining for those that are not familiar. A term wrapped in a&nbsp;<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/dfn\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>&lt;dfn&gt;<\/strong><\/a>&nbsp;tag will be defined by the text that surrounds it. This is an inline element and is designed to be used to highlight definitions in human language.<\/p>\n\n\n\n<h3 id=\"06-lt-figure-gt-xa0\">06. &lt;figure&gt;&nbsp;<\/h3>\n\n\n\n<p>A figure is defined as a unit of content that often appears in the main flow of a document but can be also interpreted separately. The&nbsp;<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/figure\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>&lt;figure&gt;<\/strong><\/a>&nbsp;element wraps an image or other reference content and can also include a description of its contents with&nbsp;<strong>&lt;figcaption&gt;<\/strong>.<\/p>\n\n\n\n<h3 id=\"07-lt-code-gt-xa0\">07. &lt;code&gt;&nbsp;<\/h3>\n\n\n\n<p>With technical writing, it can be useful to visually separate computer code from the rest of the sentence. By wrapping each occurrence in a&nbsp;<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/code\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>&lt;code&gt;<\/strong><\/a>&nbsp;tag, the browser can apply some default formatting to display it more appropriately. Combine with&nbsp;<strong>&lt;pre&gt;<\/strong>&nbsp;for larger code blocks.<\/p>\n\n\n\n<h3 id=\"08-lt-time-gt-xa0\">08. &lt;time&gt;&nbsp;<\/h3>\n\n\n\n<p>We can write time values differently depending on the context or the language. By marking these values with the&nbsp;<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/time\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>&lt;time&gt;<\/strong><\/a>&nbsp;tag, search engines and other automated tooling can quickly extract this information. Use the \u201cdatetime\u201d attribute to supply a specific time in a more machine-friendly format.<\/p>\n\n\n\n<h2 id=\"5-html-tags-to-avoid\">5 HTML Tags to Avoid<\/h2>\n\n\n\n<p>The HTML specification has a lot of legacy tags that can still be used, and will still work, but the simple fact is, there is usually a better alternative out there. And, if there is a better option then you really need to be using it.&nbsp;<\/p>\n\n\n\n<p>There is also the issue of &nbsp;browser support. Some tags will no longer be supported in every browser, but these can go unnoticed when looking at the design of a page. Again these need to be replaced.&nbsp;<\/p>\n\n\n\n<p>Below you will find five tags that should definitely not be sitting inside the HTML of any page. If you spot any of these in your code make sure they are replaced with a more suitable tag or removed altogether.<\/p>\n\n\n\n<h3 id=\"01-lt-font-gt\">01. &lt;font&gt;<\/h3>\n\n\n\n<p>Historically, the&nbsp;<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/font\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>&lt;font&gt;<\/strong><\/a>&nbsp;tag was used to style a block of text, it\u2019s now best to target and style text with CSS. According to&nbsp;<a href=\"https:\/\/www.advancedwebranking.com\/\" rel=\"noreferrer noopener\" target=\"_blank\">Advanced Web Ranking<\/a>, nearly 6.5 million websites still use the tag despite it being deprecated for many years.<\/p>\n\n\n\n<h3 id=\"02-lt-menuitem-gt-xa0\">02. &lt;menuitem&gt;&nbsp;<\/h3>\n\n\n\n<p>When combined with&nbsp;<strong>&lt;menu&gt;<\/strong>, the&nbsp;<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/menuitem\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>&lt;menuitem&gt;<\/strong><\/a>&nbsp;tag would supply options and actions to perform inside context menus. This has now been removed from the specification as it did not receive much browser support.<\/p>\n\n\n\n<h3 id=\"03-lt-big-gt-xa0\">03. &lt;big&gt;&nbsp;<\/h3>\n\n\n\n<p>The&nbsp;<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/big\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>&lt;big&gt;<\/strong><\/a>&nbsp;tag would have increased the size of the text inside the tag by one level. Its companion&nbsp;<strong>&lt;small&gt;<\/strong>&nbsp;is still valid HTML, but now has a more defined semantic meaning referring to small print.<\/p>\n\n\n\n<h3 id=\"04-lt-center-gt-xa0\">04. &lt;center&gt;&nbsp;<\/h3>\n\n\n\n<p>Previously the&nbsp;<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/center\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>&lt;center&gt;<\/strong><\/a>&nbsp;tag was the only way to centralise both block and inline content, but it has now been replaced with \u201c<strong>text-align: center<\/strong>\u201d in CSS, which performs the same job.&nbsp;<\/p>\n\n\n\n<h3 id=\"05-lt-marquee-gt-xa0\">05. &lt;marquee&gt;&nbsp;<\/h3>\n\n\n\n<p>The\u00a0<a rel=\"noreferrer noopener\" href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/marquee\" target=\"_blank\"><strong>&lt;marquee><\/strong><\/a>\u00a0tag allowed the text inside the tag to move across the screen like a news ticker. While previously a popular feature of the web it has been classed as obsolete in favour of\u00a0CSS-based animations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The introduction of the HTML5 specification brought with it a host of new semantic tags, giving more meaning to HTML tags. This meant that web designers no longer needed to produce swatches of &lt;div> tags to build their site structure. The basic semantic\u00a0HTML tags\u00a0such as\u00a0&lt;header>,\u00a0&lt;footer>\u00a0and\u00a0&lt;nav>\u00a0are almost self explanatory. But, there are a host of newer [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":3615,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[145,77],"tags":[146,116,73],"jetpack_featured_media_url":"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2020\/01\/HTML-Tags-Uses-Best-Practices.png","jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p7FQPL-Wi","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/3614"}],"collection":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/comments?post=3614"}],"version-history":[{"count":1,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/3614\/revisions"}],"predecessor-version":[{"id":3616,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/3614\/revisions\/3616"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/media\/3615"}],"wp:attachment":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/media?parent=3614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/categories?post=3614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/tags?post=3614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}