{"id":9262,"date":"2022-10-06T03:55:14","date_gmt":"2022-10-06T03:55:14","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=9262"},"modified":"2022-10-06T03:55:14","modified_gmt":"2022-10-06T03:55:14","slug":"html-tag-2","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/10\/06\/html-tag-2\/","title":{"rendered":"HTML <a> Tag"},"content":{"rendered":"\n<p>The&nbsp;&lt;a&gt;&nbsp;tag is used to insert hyperlinks to other pages, or files, locations within the same page, email addresses, or any different URL. You can use both text and image as a hyperlink.<\/p>\n\n\n\n<p>In the browser, hyperlinks differ in their appearance and color. By default,\u00a0HTML links\u00a0appear as underlined blue text. When you hover your mouse over a link, it turns red (active link). Links that are already clicked (visited links) become purple.<\/p>\n\n\n\n<p>You can change the color of links,\u00a0remove underline\u00a0or\u00a0change the color of the links\u00a0using\u00a0CSS\u00a0styles.<\/p>\n\n\n\n<p>The &#8220;download&#8221;, &#8220;media&#8221;, &#8220;hreflang&#8221;, &#8220;target&#8221;, &#8220;rel&#8221;, and &#8220;type&#8221; attributes will be present only if the &#8220;href&#8221; attribute is present.<\/p>\n\n\n\n<p>Until you define another target, a linked page is shown in the current browser window.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"syntax-4\">Syntax<\/h2>\n\n\n\n<p>The&nbsp;&lt;a&gt;&nbsp;tag comes in pairs. The content is written between the opening (&lt;a&gt;) and closing (&lt;\/a&gt;) tags.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"attributes-6\">Attributes<\/h2>\n\n\n\n<p>The&nbsp;&lt;a&gt;&nbsp;tag can have attributes that provide additional information about it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"the-span-class-attribute-href-span-attribute-8\">The&nbsp;href&nbsp;attribute<\/h3>\n\n\n\n<p>The&nbsp;href&nbsp;is a required attribute of the&nbsp;&lt;a&gt;&nbsp;tag. It defines a link on the web page or a place on the same web page, where the user navigates after having clicked on the link. The value of the attribute is either an anchor or a URL. The anchor points to the ID (unique identifier) of the part of the web page referenced. Before the ID we put a hash (#).<\/p>\n\n\n\n<p>It looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;a href=\"url\"&gt;the link text&lt;\/a&gt;\n\n&lt;a href=\"#a\"&gt;the link text&lt;\/a&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-the-html-span-class-tag-lt-a-gt-span-tag-with-the-span-class-attribute-href-span-attribute-11\">Example of the HTML&nbsp;&lt;a&gt;&nbsp;tag with the&nbsp;href&nbsp;attribute:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the document&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;a href=\"https:\/\/www.w3docs.com\/\"&gt;W3docs.com&lt;\/a&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>Click on the link, and you will be redirected to the home page of our website.<\/p>\n\n\n\n<p>Using the\u00a0href\u00a0attribute of the\u00a0&lt;a>\u00a0tag with the\u00a0&lt;img>\u00a0tag you can make a linked image.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-the-html-span-class-tag-lt-a-gt-span-tag-for-creating-a-linked-image-15\">Example of the HTML&nbsp;&lt;a&gt;&nbsp;tag for creating a linked image:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the document&lt;\/title&gt;\n    &lt;style&gt;\n      img {\n        height: 90vh;\n      }\n    &lt;\/style&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;a href=\"https:\/\/en.wikipedia.org\/wiki\/France\"&gt;\n      &lt;img src=\"https:\/\/images.unsplash.com\/photo-1549144511-f099e773c147?ixlib=rb-1.2.1&amp;ixid=eyJhcHBfaWQiOjEyMDd9&amp;w=1000&amp;q=80\" alt=\"France\"&gt;\n    &lt;\/a&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"the-span-class-attribute-target-span-attribute-17\">The&nbsp;target&nbsp;attribute<\/h2>\n\n\n\n<p>The&nbsp;target&nbsp;attribute is used to tell the browser where to open the document (by default, links open in the current window).<\/p>\n\n\n\n<p>The&nbsp;target&nbsp;attribute can have the following values:<\/p>\n\n\n\n<ul><li><strong>_blank<\/strong>\u2013 opens the link in a new window.<\/li><li><strong>_self<\/strong>-opens the link in a current window.<\/li><li><strong>_parent<\/strong>&nbsp;&#8211; opens the document in the parent frame.<\/li><li><strong>_top<\/strong>&nbsp;&#8211; opens the document in full width of the window.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-the-html-span-class-tag-lt-a-gt-span-tag-with-the-span-class-attribute-target-span-attribute-19\">Example of the HTML&nbsp;&lt;a&gt;&nbsp;tag with the&nbsp;target&nbsp;attribute:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the document&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;a href=\"https:\/\/www.w3docs.com\/\" target=\"_blank\"&gt;W3docs.com&lt;\/a&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"the-span-class-attribute-rel-span-attribute-23\">The&nbsp;rel&nbsp;attribute<\/h2>\n\n\n\n<p>This attribute sets the relationship of the current document to the linked one. The attribute values can be as follows:<\/p>\n\n\n\n<ul><li><strong>alternate&nbsp;<\/strong>&#8211; an alternative version of the document.<\/li><li><strong>author<\/strong>&#8211; reference to the author of the document or article.<\/li><li><strong>bookmark&nbsp;<\/strong>&#8211; a permanent link to be used for bookmarks.<\/li><li><strong>nofollow<\/strong>&nbsp;&#8211; links to an unendorsed document (this instructs the search engines that the crawler should not follow that link).<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"no-follow-value-25\">No follow value<\/h3>\n\n\n\n<p>If you want to create a nofollow link, use rel=&#8221;nofollow&#8221;. This informs search engines that you don&#8217;t support the content at the other end of the link. The nofollow attribute value is generally used on paid links and advertising. Sometimes the unfollow is considered to be a tag or attribute, but in fact, it\u2019s a value of the&nbsp;rel&nbsp;attribute.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-the-span-class-attribute-rel-span-attribute-with-the-nofollow-value-27\">Example of the&nbsp;rel&nbsp;attribute with the &#8220;nofollow&#8221; value:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the document&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;p&gt;Lorem ipsum, or lipsum as it is sometimes known, is dummy text used in laying out print, graphic or web designs. The passage is attributed to an unknown typesetter in the 15th century who is thought to have scrambled parts of Cicero's De Finibus Bonorum et Malorum for use in a type specimen book.&lt;\/p&gt;\n    &lt;p&gt;This text is from &lt;a href=\"https:\/\/www.lipsum.com\/\" rel=\"nofollow\" target=\"_blank\"&gt;Lorem Ipsum&lt;\/a&gt;.&lt;\/p&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"attributes-29\">Attributes<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Attribute<\/th><th>Value<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>charset<\/td><td>char_encoding<\/td><td>Defines the character-set of a linked document.<br><strong>Not used in HTML5.<\/strong><\/td><\/tr><tr><td>coords<\/td><td>coordinates<\/td><td>Defines the coordinates of a link.<br><strong>Not used in HTML5.<\/strong><\/td><\/tr><tr><td>download<\/td><td>filename<\/td><td>Defines that the target will be downloaded when a hyperlink is clicked.<\/td><\/tr><tr><td>href<\/td><td>URL<\/td><td>Defines the URL of the linked document.<\/td><\/tr><tr><td>hreflang<\/td><td>language_code<\/td><td>Defines the language of the linked document.<\/td><\/tr><tr><td>media<\/td><td>media_query<\/td><td>Defines what media\/device the linked document is optimized for.<\/td><\/tr><tr><td>name<\/td><td>section_name<\/td><td>Defines the name of an anchor.<br><strong>Not used in HTML5.<\/strong><\/td><\/tr><tr><td>ping<\/td><td>list_of_URLs<\/td><td>Defines a space-separated list of URLs to which, when the link is followed, post requests with the body ping will be sent by the browser (in the background). Typically used for tracking.<\/td><\/tr><tr><td>rel<\/td><td>alternate<br>author<br>bookmark<br>external<br>help<br>license<br>next<br>nofollow<br>noreferrer<br>noopener<br>prev<br>search<br>tag<\/td><td>Defines the relationship between the target object and the linked document.<\/td><\/tr><tr><td>rev<\/td><td>text<\/td><td>Defines a reverse link, the inverse relationship of the &#8220;rel&#8221; attribute.<br><strong>Not used in HTML5.<\/strong><\/td><\/tr><tr><td>shape<\/td><td>default<br>rect<br>circle<br>poly<\/td><td>Defines the shape of the hyperlink.<br><strong>Not used in HTML5.<\/strong><\/td><\/tr><tr><td>target<\/td><td>_blank<br>_parent<br>_self<br>_top<\/td><td>Defines where to open the linked document.<\/td><\/tr><tr><td>type<\/td><td>media_type<\/td><td>Defines the media type in the form of a\u00a0MIME- type\u00a0for the linked URL.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The\u00a0&lt;a>\u00a0tag also supports the\u00a0Global Attributes\u00a0and the\u00a0Event Attributes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to style &lt;a&gt; tag?<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Common properties to alter the visual weight\/emphasis\/size of text in &lt;a&gt; tag:<\/h3>\n\n\n\n<ul><li>CSS font-style\u00a0property sets the style of the font. normal | italic | oblique | initial | inherit.<\/li><li>CSS font-family\u00a0property specifies a prioritized list of one or more font family names and\/or generic family names for the selected element.<\/li><li>CSS font-size\u00a0property sets the size of the font.<\/li><li>CSS font-weight\u00a0property defines whether the font should be bold or thick.<\/li><li>CSS text-transform\u00a0property controls text case and capitalization.<\/li><li>CSS text-decoration\u00a0property specifies the decoration added to text, and is a shorthand property for text-decoration-line, text-decoration-color, text-decoration-style.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Coloring text in &lt;a&gt; tag:<\/h3>\n\n\n\n<ul><li>CSS color\u00a0property describes the color of the text content and text decorations.<\/li><li>CSS background-color\u00a0property sets the background color of an element.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Text layout styles for &lt;a&gt; tag:<\/h3>\n\n\n\n<ul><li>CSS text-indent\u00a0property specifies the indentation of the first line in a text block.<\/li><li>CSS text-overflow\u00a0property specifies how overflowed content that is not displayed should be signalled to the user.<\/li><li>CSS white-space\u00a0property specifies how white-space inside an element is handled.<\/li><li>CSS word-break\u00a0property specifies where the lines should be broken.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Other properties worth looking at for &lt;a&gt; tag:<\/h3>\n\n\n\n<ul><li>CSS text-shadow\u00a0property adds shadow to text.<\/li><li>CSS text-align-last\u00a0property sets the alignment of the last line of the text.<\/li><li>CSS line-height\u00a0property specifies the height of a line.<\/li><li>CSS letter-spacing\u00a0property defines the spaces between letters\/characters in a text.<\/li><li>CSS word-spacing\u00a0property sets the spacing between words.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The&nbsp;&lt;a&gt;&nbsp;tag is used to insert hyperlinks to other pages, or files, locations within the same page, email addresses, or any different URL. You can use both text and image as a hyperlink. In the browser, hyperlinks differ in their appearance and color. By default,\u00a0HTML links\u00a0appear as underlined blue text. When you hover your mouse over [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[529],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/9262"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=9262"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/9262\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=9262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=9262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=9262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}