What Is The HTML Target Attribute?

ExploreEXPLORE THE CATALOGSupercharge your career with 700+ hands-on coursesView All CoursesPythonJavaJavaScriptCReactDockerVue JSRWeb DevDevOpsAWSC#LEARNING TOOLSExplore the industry's most complete learning platformCoursesLevel up your skillsSkill PathsAchieve learning goalsProjectsBuild real-world applicationsMock InterviewsNewAI-Powered interviewsPersonalized PathsGet the right resources for your goalsLEARN TO CODECheck out our beginner friendly courses.PricingFor BusinessResourcesNewsletterCurated insights on AI, Cloud & System DesignBlogFor developers, By developersFree CheatsheetsDownload handy guides for tech topicsAnswersTrusted answers to developer questionsGamesSharpen your skills with daily challengesSearchCoursesLog InJoin for freeWhat is the HTML target attribute?

Overview

The target attribute in HTMLHyperText Markup Language is used to set or specify where we want to open the linked document. We can use the target attributes on the following elements listed below:

  • <a>
  • <area>
  • <base>
  • <form>

Syntax

<element target="_blank|_self|_parent|_top|framename"\>

Parameters

  • _blank: This is used to open the link in a new window.

  • _self: This is the default value. It is used to open the link in the same window.

  • _top: This is used to open the document linked in the full body.

  • _parent: This is used to open the link in the parent frameset.

  • framename: The document is opened in the specific frame name.

Example

The HTML code provided below demonstrates how to use the target attribute:

OutputHTML

Explanation

The link is opened in the new window because the target attribute is set to _blank. We can also set the parameters according to our own choice.

Relevant Answers

Explore Courses

Free Resources

License: Creative Commons-Attribution-ShareAlike 4.0 (CC-BY-SA 4.0)

Từ khóa » Html5 A Tag Target