Attribute Substring Selectors : selector « Style Basics « HTML / CSS

Attribute Substring Selectors

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns='' xml:lang='en'>
        <title>Attribute Substring Selectors</title>
<style type='text/css'>
body {
    font: 14px sans-serif;
h1 {
    font-size: 16px;
ul {
    list-style: none;
li {
    margin: 5px 0;
a {
    padding-left: 20px;
a[href^="ftp://"] {
    color: goldenrod;
    background: url('save.png') no-repeat left center;
a[href*="#"] {
    color: cadetblue;
    background: url('anchor.png') no-repeat left center;
a[href$=".html"] {
    color: dodgerblue;
    background: url('firefox.png') no-repeat left center;
a[href$=".pdf"] {
    color: red;
    background: url('pdf.png') no-repeat left center;

        <h1>Attribute Substring Selectors</h1>
            <li><a href='index.html'>HTML Page Link</a></li>
            <li><a href='document.pdf'>PDF Link</a></li>
            <li><a href=''>FTP Link</a></li>
            <li><a href=''>Anchor Link</a></li>


Related examples in the same category

1.Universal Selector
2.The Type Selector
3.The Class Selector
4.The ID Selector
5.The Child Selector
6.The Descendent Selector
7.The Adjacent Sibling Selector
8.Attribute Selectors
9.Using Attribute Selectors to select different textfields
10.Using Attribute Selectors to choose anchor by link type
11.Using Attribute Selectors to choose only mailto anchor type
12.Using Attribute Selectors to choose linked file type for anchor
13.Using Attribute Selectors to choose php links
14.Using Dynamic Pseudo-Classes to change color
15.Using Dynamic Pseudo-Classes to add text decoration
16.Dynamic Pseudo-Classes: hover effect
17.Selectors and Grouping
18.Class Selectors: A class represents something that you can have more than one of.
19.chain together class names within the class attribute.
20.An id is used but once per document.
21.Universal selectors are wildcard selectors.
22.Descendant Selectors
23.Next Sibling Selectors
24.Pseudo-Element Selectors
25.Dynamic Pseudo-Class Selectors
26.Using Different Selectors to Apply Styles
27.First Child Pseudo-Selector
28.Before and After Pseudo Selectors
29.Selector Basics
30.Style sheet for example demonstrating adjacent sibling and child selectors
31.paragraph with id selector
32.Direct Child Selectors
33.A specific selector wins, the last one wins
34.Select one item adjacent sibling combinator