在复制未转换的文本时,在页面中将一个字母显示为另一个 [英] Display one letter as another in page while copying untransformed text

查看:85
本文介绍了在复制未转换的文本时,在页面中将一个字母显示为另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CSS中, .someclass {text-transform:uppercase} 将类 someclass 但是当我选择文本,复制和粘贴到文本编辑器或电子邮件时,字母保留其原始大小写。除了CSS以外,某些客户端网络样式技术允许文档定义一个自定义文本转换来将除大小写之外的其他内容(例如 r )更改为 w 或,而没有在用户复制文本时应用转换?

In CSS, .someclass { text-transform: uppercase } translates all text with class someclass to uppercase, but when I select the text, copy, and paste into a text editor or e-mail, the letters retain their original case. Does some client-side web styling technology other than CSS let a document define a custom text transformation to change things other than case, such as r to w or f to , without having the transformation applied when the user copies the text?

使用CSS推荐的JavaScript替换特定的字符。我更喜欢使用一些(非CSS)声明式造型技术,而不是脚本,原因如下:

Answers to Replace a particular character using css recommended JavaScript. I'd prefer to use some (non-CSS) declarative styling technology instead of script for a few reasons:


  1. - 以与 text-transform 属性相同的方式返回原始文本而不是转换后的文本。


  2. 我缺少有关我的网站的多少个观看者使用NoScript或其他脚本白名单插件的统计信息,如果用户输入未转换的字母,在。但之后,我经常访问一个在线论坛,用户经常吹嘘没有受到特定漏洞的影响,因为他们不运行JavaScript

  3. 一个脚本运行<$ c

  1. I want copy-and-paste to return the original text, not the transformed text, in the same way as the text-transform property.
  2. I want "Find within page" (Ctrl+F) to work if the user types the untransformed letter.
  3. I lack statistics on how many viewers of my site use NoScript or some other script whitelisting plug-in. But then skewed by the fact that I regularly visit an online forum whose users often brag about not being affected by a particular exploit because they don't run JavaScript
  4. A script that runs onload will cause a noticeable flash of unstyled content as the lines are rewrapped.


$ b

Lately I was able to write an XSLT stylesheet to alter text nodes within the <body>, based on an answer to a question about whitelisting characters. (Hint: match="html:body//text()" and translate().) It fails the copy and Ctrl+F criteria, and it reportedly fails the no-FOUC criterion in browsers that try to get too clever, but it should load in just about every major browser since IE 6 even with script turned off. However, a year ago, Google tried to kill client-side XSLT a year ago by removing it from Blink. If Chrome, Opera, and other Chromium-based browsers end up dropping XSLT over this, no-XSLT users will probably outnumber no-script users.

获取一个libre字体并修改它以包括 @ font-face font-feature-settings font-variant-ligatures 可以触发唯一的方式?

Is acquiring a libre font and modifying it to include custom forms and ligatures that @font-face, font-feature-settings, and font-variant-ligatures can trigger the only way?

推荐答案

CSS - 级联样式表,顾名思义,它仅用于样式表(html页面)。代码片段 .someclass {text-transform:uppercase} 只是将标签内的字符(字母表)样式化为 someclass 。它不容易,或者我可以说,它不可能实现你的需要只使用CSS而不是JavaScript。

CSS - Cascade Style Sheets, as the name implies, it is used only to stylize the sheets (html pages). The snippet .someclass { text-transform: uppercase } is just stylizing the characters (alphabets) inside the tag with class someclass. Its not easy or can I say that its not possible to achieve your need using only CSS and not JavaScript.

根据 Zach Saucier 对您的问题的评论,使用CSS没有很好的方法这样做,我也同意这一点。

According to Zach Saucier's comment for your question, "There is no good way to do this with CSS", And I too agree that.

使用JavaScript绝对可能。但您的标准不希望您这样做。

Using JavaScript its absolutely possible. But your criteria doesn't want you to do so.

我向您请求,尝试使用JavaScript或尝试不使用CSS。

My request to you, try using JavaScript or try not using CSS.

这篇关于在复制未转换的文本时,在页面中将一个字母显示为另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆