In CSS, attribute selectors describe styles those are applicable to matching attributes or attribute values of elements of an HTML page.

Syntax of CSS attribute selector :

[name_of_the_attribute] { CSS-Property: value; …………………… }

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Attribute and Value Selector</title>
    <style>
        a[target="_top"] {
            background-color: yellow;
            color: red;
        }
    </style>
</head>
<body>
    <p>The links with a target attribute gets a yellow background.</p>
    <a href="https://www.educationidol.in/" target="_top">Education Idol Website</a>
    &nbsp;&nbsp;&nbsp;&nbsp;
    <a href="https://globalinstitute.co.in/">Global Computers</a>
    &nbsp;&nbsp;&nbsp;&nbsp;
    <a href="https://akashelectrical.co.in/" target>Akash Electrical</a>
</body>
</html>

Show Output :

CSS 09 Attri with value Sel Image
[social_share_button themes='theme1']

Leave a Comment