css| Skills | link | design | Web Page design Sometimes we may want internal links to display different styles from external links, such as external links. I want to add a small icon next to the link to indicate that it is an external link that tells the caller to confirm whether it is open in a new window or in this window. We might have done this:
. external
{
Background:url (images/external.gif) no-repeat right top;
padding-right:12px;
}
Then give each external link to use the CSS, of course, this is not not not, but too cumbersome.
Is there any good way to achieve it? Yes. You can take advantage of the attribute selection in CSS3, but this method is not supported in IE6 and the following versions are already implemented in Firefox.
The basic syntax for the property selector is: [Att^=val]
For example:
A[href^= "Http://www.webjx.com"]
{
Background-image:none;
padding-right:0px;
}
Finds all links that start with http://www.webjx.com and excludes background pictures. With the above attributes, it is good to do.
<style type= "Text/css" >
A
{
Background:url (external.gif) no-repeat right top;
padding-right:14px;
font-size:12px;
}
A[href^= "Http://www.webjx.com"]
{
Background-image:none;
padding-right:0px;
}
</style> first to all the links with the icon, and then remove the beginning of the http://www.webjx.com link icon, so that the implementation of the external link Display icon, the internal link does not display the icon.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.