智能报价没有“破解”复制和粘贴?

时间:2009-07-06 18:24:02

标签: css text user-interface smart-quotes

我真的不喜欢“智能引号”,原因很简单 - 当我复制包含它们的文本时,它不再像键入的原始""那样,而是以Unicode符号结束。

智能引用是一种视觉上的改进,所以不应该真正“融入”文本,所以..我想知道,有可能使用CSS显示智能引号吗?

基本上,文本将显示为..

This is an “example”

..但查看来源,或复制和粘贴会显示:

This is an "example"

2 个答案:

答案 0 :(得分:3)

理论上 HTML有<q>元素来解决这个问题。

不幸的是,在实践中你根本不会复制任何引号(IE不支持它,Gecko不复制引号)或复制的智能引号。

答案 1 :(得分:0)

如果您使用font-style: italic设置样式,那么它们似乎与智能引号非常相似,但我不确定您是否会对<em></em>的每个实例更开心。 .magic-quotes {font-style: italic; } <span class="magic-quotes">"</span>quoted-text<span class="magic-quotes">"</span>

:before

或者,如果你使用:after .stuff-to-magic-quote:before {content: '"'; font-style: italic; } .stuff-to-magic-quote:after {content: '"'; font-style: italic; } <span class="stuff-to-magic-quote">this text would be quoted</span>. psuedo-class,可能

<em>

但是你不会在副本和版本中得到引号。糊。

我认为你可能需要某种形式的JS来实现你想要的东西;自动设置引号的样式,并允许它们被复制和放大用非魔法引用的格式粘贴。

编辑补充说,我分享你不喜欢魔法引用及其副本&amp;粘贴问题。之后编辑修改了令人发指的<span>标记,并将它们改为.original-quotes-open {margin: 0 -2em 0 0; z-index: 0; } .original-quotes-close {margin: 0 0 0 -2em; z-index: 0; } /* the idea of the -2em and z-index is to position the original non-magic quotes behind the text, but not remove them from the document */ span.quoted-text {z-index: 2; /* or higher than the .original-quotes... classes */ span.quoted-text:before {content: "“"; } span.quoted-text:after {content: "”"; } <span class="original-quotes-open">"</span><span class="quoted-text">This text is quoted</span><span class="original-quotes-close">"</span> s。

......现在,我觉得你可能会更进一步,但可能因太少的实际奖励打字太多了。

{{1}}

但是,说实话,我没有从额外的努力中看到积极的结果。

相关问题