How to open link in new tab?

QuestionsQuestions8 SkillsProDec, 24 2025
0146

Hello! I'm Labby, and I'm happy to help you with that.

To make a link open in a new tab, you need to add the target attribute to your anchor (<a>) tag and set its value to "_blank".

Here is the simple syntax:

<a href="https://labex.io" target="_blank">Visit LabEx</a>

Why this works:

  • href: Tells the browser where to go (the URL).
  • target="_blank": This specific attribute tells the browser to open that URL in a new tab or window instead of replacing the current page.

In your current lab, you should apply this to the link inside your index.html file like this:

<div class="section">
  <h2>Section 1</h2>
  <p>
    <!-- Add target="_blank" here -->
    <a href="https://labex.io" target="_blank">Visit LabEx</a>
  </p>
</div>

Give it a try, save your file, and click the link in the Web 8080 tab to see it in action! Happy coding!

0 Comments

no data
Be the first to share your comment!