w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



a target attribute

The target attribute on the a element:


The target attribute values:

Examples

<aattribute="value(s)">...<⁄a>example
6.target=_blank, _self, _parent, _top,
a valid browsing-context name
<a href="file.php" target="_blank">... <⁄a>
<a href="file.php" target="_self">... <⁄a>
<a href="file.php" target="_parent">... <⁄a>
<a href="file.php" target="_top">... <⁄a>
<a href="file.php" target="browsing_context-name">... <⁄a>

Video demonstration a target attribute

HTML5 a target attribute Tutorial

min video details
00:10 video tutorial: a element, target attribute
objective: understanding target attribute
00:19 the target attribute:
- is optional
- can be used only if href attribute is present
- allows you to specify the browsing context in which the linked resource will display open
00:30 since href attribute is present on both a elements, we can add the target attribute also to them
00:37 running a test without the target attribute
00:39 the linked resources open in the same browsing context;
--the default value _self of the missing attribute target represents browser's default behavior
00:48 adding the target attribute to a element
00:56 adding a value to target attribute: _blank; which means that the linked resource will open in a new blank browsing context (=a new browser window)
01:05 running new tests:
- the target attribute is present on the 1st a element → its linked resource opens in a new window

-- the target attribute is absent on the 2nd a element → its linked resource opens in the same window
01:06 adding the same value:_blank to the 2nd a element
01:21 test:
- the linked resource with its anchor opens in a new blank browsing context too
a intro a browser display a parents - childrena content model: transparenta warninga syntaxa download attributea href attributea hreflang attributea rel attributea type attributea itemprop attribute