Let's see exactly what attribute selectors can do. In the following HTML markup, you'll see a variety of links. Just pop this into an HTML document and we'll be good to go:
<body> <p>Go to the <a href="http://mywebsite.com">home page</a>.</p> <p><a href="http://mywebsite.com/about">This link</a> will not go to the home page.</p> <p>Please <a href="mailto:[email protected]">email me </a>or <a href="mailto:[email protected]">email Matt</a>.</p> <p>Download this <a href="foo.zip">ZIP file</a>.</p> </body>
You should have something like this:
Let's style the first link with MooTools. Its href
attribute http://mywebsite.com . Let's say that we want all links in our web page to point to the site's home page, and they will be a green color. We'll use the .setStyle()
method to apply the style.
To select all links in a web page that...