如何对齐blockquote打开和关闭引号?

时间:2018-03-26 16:19:53

标签: html css sass blockquote

目前我们正在使用<blockquote>通过CSS为字符串添加开头和结尾引号,因为我们需要自定义样式。但是,它们没有与开头前的开头报价和文本末尾的结束报价内联。

我们如何修复路线?

blockquote {
  font-style: italic;
  border: none;
  quotes: "\201C" "\201D" "\2018" "\2019";
  display: block;
}

blockquote:before {
  content: open-quote;
  font-weight: bold;
  color: red;
}

blockquote:after {
  content: close-quote;
  font-weight: bold;
  color: red;
}
<blockquote>
  <p>Competently conceptualize clicks-and-mortar customer service without front-end opportunities. Interactively morph visionary intellectual capital without mission-critical manufactured products. Dramatically grow extensible portals vis-a-vis.</p>
</blockquote>

目前的结果 Current issues

预期结果 desired output

1 个答案:

答案 0 :(得分:2)

这是因为您的内容位于p标记内,并且不是内联元素,默认情况下是一个块。因此,要么删除该标记,要么将其设置为内联

删除标记

&#13;
&#13;
blockquote {
  font-style: italic;
  border: none;
  quotes: "\201C" "\201D" "\2018" "\2019";
  display: block;
  text-align:center;
}

blockquote:before {
  content: open-quote;
  font-weight: bold;
  color: red;
}

blockquote:after {
  content: close-quote;
  font-weight: bold;
  color: red;
}
&#13;
<blockquote>
  Competently conceptualize clicks-and-mortar customer service without front-end opportunities. Interactively morph visionary intellectual capital without mission-critical manufactured products. Dramatically grow extensible portals vis-a-vis.
</blockquote>
&#13;
&#13;
&#13;

样式化为内嵌

&#13;
&#13;
blockquote {
  font-style: italic;
  border: none;
  quotes: "\201C" "\201D" "\2018" "\2019";
  display: block;
  text-align: center;
}

blockquote:before {
  content: open-quote;
  font-weight: bold;
  color: red;
}

blockquote:after {
  content: close-quote;
  font-weight: bold;
  color: red;
}

blockquote p {
  display: inline;
}
&#13;
<blockquote>
  <p>Competently conceptualize clicks-and-mortar customer service without front-end opportunities. Interactively morph visionary intellectual capital without mission-critical manufactured products. Dramatically grow extensible portals vis-a-vis.</p>
</blockquote>
&#13;
&#13;
&#13;