Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML Introduction to HTML and CSS (2016) HTML: The Structural Foundation of Web Pages and Applications Anchor Tags

mohamed roshdy
mohamed roshdy
3,321 Points

other values to the target attribute.

when I searched the target attribute I found that there are other values for it besides "_blank". there are "_self", "blank", and "_top". However, only "_self" and "_blank" are working, and I don't know why. In addition. I can't even understand what the other values do.

1 Answer

Target values like _parent and _top are deprecated in HTML5, and I think it's enough to use _self (default), or _blank. The differences about them are which frame you open the contents you link to:

  • _self opens in the same frame (the same tab/window)
  • _blank opens in a new frame (new tab/window)
  • _parent opens in the parent frame (same tab/window, but in the frame that wraps around the frame with your <a>-element)
  • _top open in top frame (same tab/window, but in the outermost frame that wraps around all other frames)

I do not think many use these frames (<frameset> and <frame>) nowadays, but it is still supported in browsers - the <iframe> is more used though..

Examples with frames:

<outer_frame>
<!-- content in outer_frame -->

     <middle_frame>
     <!-- content in middle_frame -->

          <inner_frame>
          <!-- content in inner_frame -->
          </inner_frame>

     </middle_frame>

</outer_frame>

If you for example got an <a>-element in the <inner_frame> with target="_parent", the content you link to would be displayed in the <middle_frame>, and if you used target="_top", the content would be displayed in the <outer_frame>.

I also think you could link the contents to specific frames with target="frame_name", but as I said, do not think this is used anymore.

mohamed roshdy
mohamed roshdy
3,321 Points

thx for your time. now I got it.