Html CSS 3:在块引用的开头添加引号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4597699/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 05:57:03  来源:igfitidea点击:

CSS 3: Adding quote symbol to beginning of blockquote

htmlcss

提问by AgileMeansDoAsLittleAsPossible

Can anyone tell me why this (also available live at http://jsfiddle.net/A2eTG/6/) renders a "symbol before the blockquote in Firefox but not Chrome/Safari?

谁能告诉我为什么这(也可以在http://jsfiddle.net/A2eTG/6/ 上实时获得)"在 Firefox 中的块引用之前呈现一个符号,而不是 Chrome/Safari?

blockquote
{
    padding: 0 60px;
    padding:10px;
    padding-left:55px;
}

blockquote:before {
    display: block;
    font-size: 700%;
    content: open-quote;
    height: 1px;
    margin-left: -0.55em;
    position:relative;
    top:-20px;
}

The blockquote:beforeselector shows up in Chrome's developer tools but doesn't appear on screen.

blockquote:before选择显示了在Chrome的开发者工具,但不会出现在屏幕上。

What gives?

是什么赋予了?

采纳答案by Brian Flanagan

Looks like Chrome doesn't support content: open-quote. Try this instead:

看起来 Chrome 不支持content: open-quote. 试试这个:

content: "\""; 

回答by etcet

To help others who came across this and want prettier quotes than ", these are the codes for double open, double closed, single open, and single closed quotation marks respectively: "\201C", "\201D", "\2018", "\2019".

为了帮助遇到此问题并想要比 更漂亮的引号的其他人",这些是双开、双闭、单开和单闭引号的代码:"\201C", "\201D", "\2018", "\2019"

回答by Sotiris

Chrome supports contentpartially, and open-quoteis not supported.

Chromecontent部分支持,open-quote不支持。

So what you can try is to use content: '“';The shortcut to print the open-quotein Windows is Alt+0147and if there is need for close-quotealso then Alt+0148.

因此,您可以尝试使用在 Windows 中content: '“';打印的快捷方式open-quoteAlt+0147,如果需要,close-quoteAlt+0148.

回答by weston

See Rendering Quotes With CSSfor more detail on this issue as well as how to localize the quotes for different languages.

有关此问题的更多详细信息以及如何本地化不同语言的引号,请参阅使用 CSS 渲染引号。

回答by Domenic

I think the best solution would be

我认为最好的解决方案是

content: '“';
content: open-quote;

That way browsers that support open-quotewould use it and ignore the earlier contentvalue, while browsers that don't know what open-quoteis will ignore that line and use the first one.

这样,支持的浏览器open-quote将使用它并忽略较早的content值,而不知道是什么的浏览器open-quote将忽略该行并使用第一个。