If you want to be able to open another website in a new tab while working on something different, or if you just want to declutter your current tabs, this article is for you. We’ll show how easy it is HTML code to make any link open in a new tab merely follow these open link in new tab html steps!
- Here’s the code that you’ll need to open a link in a new tab: <a href=”http://www.example-site.com” target=”_blank”>Link Text</a>.Let’s break down this code so that we can understand what each part does.
- The first section is the opening <a> tag. This tells the web browser that we want to create a hyperlink. Next is the URL that we want to link to, which is enclosed in quotation marks. In this case, we’re using “http://www.example-site.com.” You’ll want to replace this with the URL of the website that you want to link to.
- After the URL, we have target=”_blank.” This tells the web browser to open the link in a new tab instead of the current one. If you omit this part of the code, the link will open in the same tab as the one where it appears.
- Finally, we have >Link Text</a>. This is the text that will appear on your website as a clickable link. You can change “Link Text” to whatever you want people to see as the clickable part of your hyperlink.
Adding The Code To Your Website:
- Now that we know what each part of the code does let’s take a look at how to add it to your website. If you’re using a content management system (CMS), then chances are you can just add the code directly into your post or page editor without having to edit any files manually. Just make sure that you’re in “Text” mode rather than “Visual” mode before adding the code. Otherwise, your CMS might strip out the HTML tags and leave only the text behind.
- If you’re not using CMS, then you’ll need access to your website’s files via FTP or some other method so that you can edit them directly on your server. Once you have access, locate the file where your hyperlink will appear and open it up in a text editor such as Notepad++ or Sublime Text.
- Once opened, Scroll through until you find where you want your hyperlink, and add the following piece of code : <a href=”http://www.<Your Site Name Here>.com” target=”_blank”>Link Text</a> .Save your changes and upload the edited version back onto your server, and that should do it!
- Depending on how your website is configured, you might need to clear your cache before the changes take effect, but after that, any visitors to your site should be able to click your newly added hyperlink and have it open up in a new tab.
Opening links in new tabs can be extremely useful if you want to reference another website while you’re reading or working on something else. It’s also a great way To declutter your current Tab situation. In this article, we showed you how to use HTML to open a link in a new tab by using a little bit of code. Hopefully, this was helpful, and now you, too, can keep your sites orderly by utilizing this skill!