css - 防止 :after close-quote from wrapping into a new line

标签 css

我正在尝试使用 :before 左引号和 :after 右引号来引用。在某些情况下,结束引号会自动换行。我想让最后一个词和引号分开,正确包装。关于如何以适用于不同内容的方式执行此操作的任何想法?我在 Drupal 中使用它,这个引用元素用在许多不同内容的文章中。

CSS:

p.quote {
  background-color: #f0f0f0;
  font-family: $didot-font;
  font-size: 25px;
  font-weight: 400;
  padding: 2rem 2.5rem;
  -webkit-text-stroke: 0;
  letter-spacing: 0.02px;
  line-height: 35px;
  color: $gray4-color;
  @extend %left-align;
  text-transform: none;
  font-style: italic;
  @extend %magin-position;

  &:before {
    content: open-quote;
  }
  &:after {
    content: close-quote;
  }
}

Twig :

<div class="col-12">
  <p class="quote" cite="">{{ content.field_quote }}</p>
</div>

最佳答案

尝试将 display:inline-block; 添加到元素中。这会将它们排成一行。

您还可以使用 position: absolute; 然后使用 topleft 属性。

关于css - 防止 :after close-quote from wrapping into a new line,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51068130/

相关文章:

css - 浏览器中的输入行为

css - 在 HTML 中将文本框居中

javascript - 在覆盖 DIV 下隐藏 Flash 的缺点

javascript - 这个 CSS 菜单是如何创建的?

css - 真的没有办法在 flexbox 中将文本环绕在图像周围吗?

webkit - CSS 字体大小和 <img> 标签

CSS如何隐藏除前3行之外的所有表格行

CSS 媒体查询覆盖页面样式,即使在较低分辨率下也是如此

css - 在 html5 的 Canvas 上放置一个 div

CSS 径向渐变 strip