target attribute … <a>

The target attribute on a element:

The target attribute values:

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>

Share it

video demonstration target attribute on a element

a target attribute

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

online web tutorials

video tutorial HTML5

Site Map

contact@w3-video.com || w3-video.com © 2014 All Rights Reserved