CSS After Element插入mailto链接? [英] CSS After Element to insert mailto link?
问题描述
我正在尝试显示mailto链接。这是CSS的可能吗?
html
< li class =fe footer_no_link>< / li>
css
.footer_column .fe:after {content:< a href =mailto:info@site.com> info@site.com< / a>; }
出现在DOM中,所以没有你不能。
但是为什么要使用CSS呢?它不是样式,正确的地方似乎是直接在HTML文件。
如果目标是阻止垃圾邮件,我通常使用这一块javascript: p>
var m;
m ='in';
m + ='f';
m + ='o @ exa';
m + ='mpl';
m + ='e.co';
m + ='m';
$ ele = document.getElementById('contact-mail');
$ ele.href ='mailto:'+ m;
$ ele.innerHTML = m;
邮件被分割,以确保邮件不会在任何文件中显示为电子邮件。 / p>
您可以在此处查看结果: http://jsfiddle.net / tzkDt /
I'm attempting to display a mailto link. Is that possible with CSS?
html
<li class="fe footer_no_link"></li>
css
.footer_column .fe:after {content:"<a href="mailto:info@site.com">info@site.com</a>"; }
Content added with the pseudo-element doesn't appear in the DOM, so no you can't. But why do you want to do it with CSS ? It is not styling, the right place seems to be directly on the HTML file.
If the goal is to block spam, I usually use this piece of javascript:
var m;
m='in';
m+='f';
m+='o@exa';
m+='mpl';
m+='e.co';
m+='m';
$ele = document.getElementById('contact-mail');
$ele.href = 'mailto:'+m;
$ele.innerHTML = m;
The mail is splitted to be sure that it doesn't appear as an email in any file.
You can see the result here: http://jsfiddle.net/tzkDt/
这篇关于CSS After Element插入mailto链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!