w3resource

HTML target attribute

target

The purpose of the HTML target attribute is to specify a window where the associated document will be displayed.

Supported elements

HTML tabindex attribute supports a, area, base, form, link element.

Syntax

<ElementName target="value" >.....</ElementName>

Where ElementName is any supported element.

Type of value

FrameTarget.

Value

Value Description
_blank The associated document is opened in a new window.
_self The associated document is opened in the same window.
_parent The associated document is opened in the immediate parent of the current window.
_top The associated document is opened in the full original window cancelling all other elements.
name Value of the name attribute of a frame.

Default value

There is no default value of HTML target attribute.

Supported doctypes

HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.

Example of HTML target attribute with a element

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML target attribute with a element</title>
</head>
<body>
<p><a href="../../index.php" target="_blank">w3resource tutorials</a></p>
</body>
</html>

Result

html target attribute with a element

View this example in a separate browser window

Example of HTML target attribute with a element

Previous: HTML tabindex attribute
Next: HTML title attribute

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/html/attributes/html-target-attribute.php