Opening Links in a New Tab

You may have noticed that some links open in a new tab. Websites do this when they send us somewhere else but expect us to come back.

We do it by adding another attribute, target, with the value _blank. Modern browsers open such a link in a new tab.

<a href="https://en.wikipedia.org/" target="_blank">Link to Wikipedia</a>

So when we want a link to open in a new tab, it has two attributes:

  • href with the address of the link,
  • target with the value _blank.

Attributes are separated by a space, and their order doesn't matter.

Instructions

Add the attribute target with the value _blank to the Source link you created in the previous exercise.

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

3/12