{"id":711,"date":"2012-01-07T15:18:00","date_gmt":"2012-01-07T15:18:00","guid":{"rendered":"http:\/\/ursula-smith.com\/mixed-media\/?p=711"},"modified":"2014-07-04T13:48:57","modified_gmt":"2014-07-04T17:48:57","slug":"how-to-make-an-html-link-in-a-web-page","status":"publish","type":"post","link":"https:\/\/ursula-smith.com\/mixed-media\/how-to-make-an-html-link-in-a-web-page\/","title":{"rendered":"How to Make an HTML Link in a Web Page"},"content":{"rendered":"<p>As I have mentioned several times, I have a group of friends that are great artists. They, however, aren&#8217;t necessarily web programmers. So, in order to help them out for an up-coming blog hop on January 9, 2012, I decided to explain how to make a link using HTML. Hopefully this helps!!<\/p>\n<p>An HTML link is created using the<strong> <span style=\"color: #ff0000;\">Anchor <\/span><\/strong>tag. It goes something like this:<\/p>\n<p><strong><span style=\"color: #ff0000;\">&lt;a href=&#8221;<span style=\"color: #3366ff;\">URL-to-the-web-page<\/span>&#8221; <span style=\"color: #339966;\">title=&#8221;<\/span><\/span><\/strong><span style=\"color: #339966;\">Some explanantion of the link, if you like<\/span><strong><span style=\"color: #ff0000;\"><span style=\"color: #339966;\">&#8220;<\/span>&gt;<\/span><span style=\"color: #3366ff;\">The Text you want display as the link in the web page<\/span><\/strong><strong><span style=\"color: #ff0000;\">&lt;\/a&gt;<\/span><\/strong><\/p>\n<p>In HTML each tag (generally) has an opening and a closing sequence. In the case of Anchor, it is <strong><span style=\"color: #ff0000;\">&lt;a&gt;<\/span><\/strong> and <strong><span style=\"color: #ff0000;\">&lt;\/a&gt;<\/span><\/strong> The <strong><span style=\"color: #ff0000;\">&lt;&gt;<\/span><\/strong> indicates it is a tag. . The <strong><span style=\"color: #ff0000;\">a <\/span><\/strong>is the tag name. The<span style=\"color: #ff0000;\"><strong> \/<\/strong><\/span> in the second sequence, <strong><span style=\"color: #ff0000;\">&lt;\/a&gt;, <\/span><\/strong> indicates it is a closing tag for the opening sequemce,<strong> <span style=\"color: #ff0000;\">&lt;a&gt;<\/span><\/strong> .<\/p>\n<p>An anchor tag has an inner link text, which is the text that will actually show up in your web page document when it is read by the browser. This goes in between the opening anchor tag sequence and the closing tag sequence. In the example above, it is the text- <strong><span style=\"color: #3366ff;\">The Text you want display as the link in the web page. <\/span><\/strong>This text can say anything you like. Most often, I actually use the URL to the web page I am trying to link to, so that in the case where the link might not work for some reason, the URL is displayed, and a user can copy the text and paste it into their browser, and they can get to the web page that way.<strong><\/strong><\/p>\n<p>The actual linking part is handled by the <span style=\"color: #ff0000;\"><strong>href <\/strong><\/span>attribute. An HTML tag attribute sits inside an opening tag sequence. So the href attribute goes inside the &lt;a&gt; tag sequence, like so<strong><span style=\"color: #ff0000;\"> &lt;a href=&#8221;&#8221;&gt;<\/span><\/strong> . What goes between the quotes is the URL to the web page that you are trying to link to. So, if I was trying to link to this blog, I would use the URL,<span style=\"color: #0000ff;\"> <strong><span style=\"color: #3366ff;\"><a href=\"http:\/\/Ursula-Smith.com\/blog\">http:\/\/Ursula-Smith.com\/blog<\/a><\/span><\/strong><\/span><strong> <\/strong>.<\/p>\n<p>The final piece, which is optional, is the title attribute, but it is a nice thing to have. The title attribute, again goes inside the opening anchor tag sequence, like so- <span style=\"color: #ff0000;\"><strong>&lt;a <\/strong><\/span><strong><span style=\"color: #ff0000;\"> <span style=\"color: #339966;\"><span style=\"color: #ff0000;\"><strong>title=&#8221;&#8221;&gt;<\/strong><\/span> . <\/span><\/span><\/strong>The title allows a user to hover over the link, and the text within the title will be displayed by the browser (most times). So, in our example, the text <strong><span style=\"color: #339966;\">Some explanantion of the link, if you like<\/span><\/strong> would be displayed. In the case where I use the URL as the link text, I usually add an explanation of the link in the title attribute.<\/p>\n<p>So here is the code for an example link to this page:<\/p>\n<p><strong><span style=\"color: #ff0000;\">&lt;a href=&#8221;http:\/\/ursula-smith.com\/how-to-make-an-html-link-in-a-web-page\/<\/span><\/strong><strong><span style=\"color: #ff0000;\">&#8221; title=&#8221;This is a test&#8221;&gt;Link to this page&lt;\/a&gt;<\/span><\/strong><\/p>\n<p>and here is the actual link:<a href=\"http:\/\/ursula-smith.com\/how-to-make-an-html-link-in-a-web-page\/\"> Link to this Page<\/a>.<\/p>\n<p>So, now things get a little bit tricky! Because this post is for a bunch of artists, you KNOW they will want to have their link text be an image rather than just text <img loading=\"lazy\" decoding=\"async\" class=\"middle\" title=\"&amp;amp;#59;&amp;amp;#41;\" alt=\"&amp;amp;#59;&amp;amp;#41;\" src=\"http:\/\/easyscraps.com\/blog\/rsc\/smilies\/icon_wink.gif\" width=\"15\" height=\"15\" \/>. No worries! Instead of just putting text in between the opening and closing anchor tag seuqences, you can put an image tag instead.<\/p>\n<p>An image tag looks something like this-<\/p>\n<p><span style=\"color: #ff0000;\"><strong>&lt;img src=&#8221;<span style=\"color: #3366ff;\">URL-to-the-image-on-a-web-server<\/span>&#8220;<\/strong><span style=\"color: #339966;\"> alt=&#8221;Alternate text in case image isn&#8217;t displayed&#8221;<\/span><strong> <\/strong><\/span><strong><span style=\"color: #ff0000;\"><span style=\"color: #339966;\">title=&#8221;<\/span><\/span><\/strong><span style=\"color: #339966;\">Some explanantion of the link, if you like<\/span><strong><span style=\"color: #ff0000;\"><span style=\"color: #339966;\">&#8220;<\/span><\/span><\/strong><span style=\"color: #ff0000;\"><strong>\/&gt;<\/strong><\/span><\/p>\n<p><span style=\"color: #ff0000;\"><span style=\"color: #000000;\">Again, we have an opening tag sequence <strong><span style=\"color: #ff0000;\">&lt;img&gt;<\/span><\/strong><span style=\"color: #000000;\"> , but instead of using a closing tag suequence<span style=\"color: #ff0000;\"><strong> &lt;\/img&gt;<\/strong><\/span> , we are using a self closing tag seuqence-<strong><span style=\"color: #ff0000;\"> &lt;img \/&gt;<\/span><\/strong> . This is because there is really nothing that goes <strong>inside <\/strong>the opening and closing tag sequences. In the anchor example, we had the link text. In an image tag, there is nothing. The only thing that you need is the src attribute, which goes inside the opening tag sequence. So, we can self close the tag by putting a <strong><span style=\"color: #ff0000;\">\/<\/span><\/strong> before the <span style=\"color: #ff0000;\">&gt; <\/span>in the opening tag sequence. <\/span><\/span><\/span><\/p>\n<p><span style=\"color: #ff0000;\"><span style=\"color: #000000;\"><span style=\"color: #000000;\">The image that you want to display must exists somewhere on a web server, that is,<strong> it can not be sourced from your local computer<\/strong>!! The source attribute, <span style=\"color: #ff0000;\"><strong>src=&#8221;&#8221;<\/strong><\/span>, will contain the URL that will point to the image on that web server. <\/span><\/span><\/span><\/p>\n<p><span style=\"color: #ff0000;\"><span style=\"color: #000000;\"><span style=\"color: #000000;\">The alternate attribute is not mandatory, but it is really nice thing to have and you really should use it. It is the text that will shown in case there is a problem displaying the image. And the title is the same as in the anchor case.<br \/>\n<\/span><\/span><\/span><\/p>\n<p>So if we put the two tags together, it would look like so:<\/p>\n<p><strong><span style=\"color: #ff0000;\">\u00a0<strong>&lt;a href=&#8221;<\/strong><\/span><\/strong><span style=\"color: #ff0000;\"><span style=\"color: #0000ff;\">http:\/\/ursula-smith.com\/how-to-make-an-html-link-in-a-web-page\/<\/span><\/span><strong><span style=\"color: #ff0000;\"><strong>&#8221; &gt;<\/strong><strong>&lt;img src=&#8221;<\/strong><\/span><\/strong><span style=\"color: #ff0000;\"><span style=\"color: #0000ff;\">http:\/\/ursula-smith.com\/mixed-media\/wp-content\/uploads\/2014\/05\/Gelli-Arts-Printed-Hand-Stickers-300&#215;440.jpg<\/span><\/span><strong><span style=\"color: #ff0000;\">&#8220;alt=&#8221;<\/span><\/strong><span style=\"color: #ff0000;\"><span style=\"color: #339966;\">Alternate text in case image isn&#8217;t displayed<\/span><\/span><strong><span style=\"color: #ff0000;\">&#8220;<strong>\u00a0<\/strong><strong>title=&#8221;<\/strong><\/span><\/strong><span style=\"color: #ff0000;\"><span style=\"color: #339966;\">This is a test for the image link<\/span><\/span><strong><span style=\"color: #ff0000;\">&#8220;\/&gt;\u00a0&lt;\/a&gt;<\/span><\/strong><\/p>\n<p><strong><\/strong>And here is the example link:<\/p>\n<figure id=\"attachment_3072\" aria-describedby=\"caption-attachment-3072\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a title=\"This is a test for the image link\" href=\"http:\/\/ursula-smith.com\/how-to-make-an-html-link-in-a-web-page\/\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-3072\" alt=\"Alternate text in case image isn't displayed\" src=\"http:\/\/ursula-smith.com\/mixed-media\/wp-content\/uploads\/2014\/05\/Gelli-Arts-Printed-Hand-Stickers-300x440.jpg\" width=\"300\" height=\"440\" srcset=\"https:\/\/ursula-smith.com\/mixed-media\/wp-content\/uploads\/2014\/05\/Gelli-Arts-Printed-Hand-Stickers-300x440.jpg 300w, https:\/\/ursula-smith.com\/mixed-media\/wp-content\/uploads\/2014\/05\/Gelli-Arts-Printed-Hand-Stickers-400x587.jpg 400w, https:\/\/ursula-smith.com\/mixed-media\/wp-content\/uploads\/2014\/05\/Gelli-Arts-Printed-Hand-Stickers-545x800.jpg 545w, https:\/\/ursula-smith.com\/mixed-media\/wp-content\/uploads\/2014\/05\/Gelli-Arts-Printed-Hand-Stickers.jpg 744w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-3072\" class=\"wp-caption-text\">Gelli Arts Printed Hand Sticker<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>Hopefully, this is helpful to those of you just starting out with HTML!!<\/p>\n<p>&nbsp;<\/p>\n<p>Adding a quick note on showing the HTML code so the user sees the actual HTML rather than the link. For instance, if you are trying to show a &#8220;grab a button&#8221; and the button keeps showing up rather than the code. You need to trick the browser into not interpreting the HTML So you would need to write your\u00a0<span class=\"commentBody\"> button code that looks something like<\/span><\/p>\n<p><strong><span style=\"color: #ff0000;\">&lt;a href=&#8221;<\/span><\/strong><span style=\"color: #0000ff;\">http:\/\/ursula-smith.com\/how-to-make-an-html-link-in-a-web-page\/<\/span><strong><span style=\"color: #ff0000;\">&#8221; &gt;<\/span><\/strong><span style=\"color: #ff0000;\"><strong>&lt;img src=&#8221;<\/strong><span style=\"color: #0000ff;\">http:\/\/ursula-smith.com\/mixed-media\/wp-content\/uploads\/2014\/05\/Gelli-Arts-Printed-Hand-Stickers-300&#215;440.jpg<\/span><\/span><span style=\"color: #3366ff;\"><span style=\"color: #ff0000;\">&#8220;<\/span><\/span><span style=\"color: #ff0000;\"><span style=\"color: #339966;\"><span style=\"color: #ff0000;\">alt=&#8221;<\/span>Alternate text in case image isn&#8217;t displayed<span style=\"color: #ff0000;\">&#8220;<\/span><\/span><strong> <\/strong><\/span><span style=\"color: #ff0000;\"><strong>title=&#8221;<\/strong><\/span><span style=\"color: #339966;\">This is a test for the image link<\/span><span style=\"color: #ff0000;\">&#8220;\/&gt; &lt;\/a&gt;<\/span><\/p>\n<p>in a slightly different manner.\u00a0 Rather than using<span class=\"commentBody\"> all the angle bracket symbols, you need to change them to &amp;lt; for the left angle bracket signs and &amp;gt; for the right angle bracket signs. By doing this, the actual HTML code is shown to the user rather than the HTML being interpreted in which case the link would be shown to the user- they would not see the HTML button code. So your<strong> &#8220;Grab My Button&#8221;<\/strong> code would look something like:<\/span><\/p>\n<p><strong><span style=\"color: #ff0000;\">&amp;lt;a<\/span><span style=\"color: #ff0000;\"> href=&#8221;<\/span><\/strong><span style=\"color: #ff0000;\"><span style=\"color: #0000ff;\">http:\/\/ursula-smith.com\/how-to-make-an-html-link-in-a-web-page<\/span><\/span><strong><span style=\"color: #ff0000;\">&#8220;<\/span><span style=\"color: #ff0000;\"> &amp;gt; &amp;lt;<\/span><span style=\"color: #ff0000;\">img src=&#8221;<\/span><\/strong><span style=\"color: #3366ff;\"><span style=\"color: #0000ff;\">http:\/\/ursula-smith.com\/mixed-media\/wp-content\/uploads\/2012\/01\/6635788089_e4ba47e872_m.jpg<\/span><strong>&#8220;<\/strong><\/span><span style=\"color: #339966;\"><strong>alt=&#8221;<\/strong><\/span><span style=\"color: #ff0000;\"><span style=\"color: #339966;\">Alternate text in case image isn&#8217;t displayed<strong><span style=\"color: #ff0000;\">&#8220;<\/span><\/strong><\/span><\/span><strong><span style=\"color: #ff0000;\"> title=&#8221;<\/span><\/strong><span style=\"color: #339966;\">This is a test for the image link<\/span><strong><span style=\"color: #ff0000;\"><span style=\"color: #339966;\">&#8220;<\/span><\/span><\/strong><span style=\"color: #ff0000;\"><strong>&amp;gt; <\/strong><\/span><strong><span style=\"color: #ff0000;\">&amp;lt;\/a&amp;gt;<\/span><\/strong><\/p>\n<p><span class=\"commentBody\">You are basically tricking the browser into not interpreting the link and image HTML code, but instead the browser will show the HTML as text. The viewer will see the HTML as they would need to type it into their web page code (or blog widget) so that the link will show correctly on their page.<\/span><\/p>\n<p><span class=\"commentBody\">Hope this helps!! <\/span><\/p>\n<div class=\"item_footer\">\n<p><small><a href=\"http:\/\/easyscraps.com\/blog\/blog6.php\/how-to-make-a-link\">\u00a0<\/a><\/small><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>As I have mentioned several times, I have a group of friends that are great artists. They, however, aren&#8217;t necessarily&#8230;<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,5],"tags":[],"class_list":["post-711","post","type-post","status-publish","format-standard","hentry","category-digital-posts","category-tech-tips"],"_links":{"self":[{"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/posts\/711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/comments?post=711"}],"version-history":[{"count":4,"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/posts\/711\/revisions"}],"predecessor-version":[{"id":3077,"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/posts\/711\/revisions\/3077"}],"wp:attachment":[{"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/media?parent=711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/categories?post=711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/tags?post=711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}