块引用引用符号在内容框外出血
我有一个块引用,其中引用符号是使用 CSS 内容生成的,使用伪选择器 :before 和 :after 如下所示:
div.paragraph blockquote::before, div.paragraph blockquote::after {
font-size: 4em;
color: #999;
position: absolute;
}
div.paragraph blockquote::before {
content: "“201C";
top: 0;
left: 0;
}
div.paragraph blockquote::after {
content: "”201D";
bottom: 0;
right: 0;
}
这会生成一个如下所示的块引用:
我想要的是将引用符号保留在各自的框中,以便它们的基线与块引用内的文本相同。
我认为这与引用符号自然基线有关,但也许有人可以详细说明?
解决此问题的一种方法可能是为引用符号提供相对字体大小的负边距,但我正在寻找更“正确”的解决方案,或者解释为什么引用符号会这样。
编辑:添加位置:相对; to div.paragraph 并不能解决这个问题,因为它已经有了position:relative。
I have a blockquote, where the citation symbols is generated with CSS Content, using pseudo-selectors :before and :after like so:
div.paragraph blockquote::before, div.paragraph blockquote::after {
font-size: 4em;
color: #999;
position: absolute;
}
div.paragraph blockquote::before {
content: "“201C";
top: 0;
left: 0;
}
div.paragraph blockquote::after {
content: "”201D";
bottom: 0;
right: 0;
}
This generates a blockquote that looks like this:
What I want, is to make the citationsymbols stay inside their respective boxes, so that their baselines would be the same as the text inside the blockquote.
I figure this has something to do with the citationsymbols natural baseline, but perhaps someone can elaborate?
One way to fix it could be to give the citationsymbols a negative margin of its relative font-size, but I'm looking for a more "correct" solution, or an explanation as to why citationsymbols act like this.
EDIT: Adding position:relative; to div.paragraph does not fix this problem, as it already has position:relative.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来您需要将“div.paragraph blockquote”设置为相对,它被视为前后内容的父容器
It seems you need to set the "div.paragraph blockquote" as relative, which is treated as the parent container of before and after contents
好的,我明白你的问题,你要做的就是添加 css:
这定义了它的子元素的上下文
OK I understand your problem, what you have do is add css for:
This defines context for its child