CSS - Attribute target

CSS - Attribute target

  • The [attribute="value"] selector is used to select elements with a named attribute and value.

Example :



Sample Code :


href="http://www.wikitechy.com" target="_bottom">
        Click Wikitechy

Code Explanation :

    a[target=-blank] is the target attribute that specifies where to open the linked document.

    Font-size property is used in CSS to increase the size of the font text. Here we have specified the font size as 40 pixels for attribute a[target]  with value as  _blank.

    In html, the <a> tag defines a hyperlink which directs the user from one page to another. target=”_blank” Opens the linked document in a new window. 

Output :

    The link “click wikitechy” will appear in blue color and underlined with a font size of 40 pixels.

  • Click wikitechy link directs us to the official wikitechy website. Which is displayed below.