Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / CSS3

Remove blue border when image is inside the hyperlink

4.94/5 (9 votes)
8 Mar 2011CPOL 15.4K  
DescriptionI...

Description


If one would want to restrict the no-border CSS rule only to certain images inside any anchor tags, it is advised to use a class CSS selector rule:

CSS Code


XML
<style type="text/css">
    a img.noborder
    {
        border: none;
    }
</style>

Usage


Using that in your HTML would look like this:
<a href="http://www.codeproject.com"><img src="Bobette.gif" alt="No border to see here!" class="noborder" /></a>


Note:


The same way that E#XYZ can be used to select any HTML element E with its attribute id set to XYZ the . can be used in E.XYZ to select any element E where its attribute class set to XYZ.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)