【问题标题】:How to add star next to blockquote text HTML?如何在块引用文本 HTML 旁边添加星号?
【发布时间】:2020-06-30 08:03:38
【问题描述】:

我正在使用 Jekyll 构建一个静态网页,并且我有几个使用 <blockquote> 的期权交易报价,目前看起来像这样:

<blockquote class="option-quote">
Risk is relative, one's perception of risk is different from anothers.
</blockquote>

&nbsp;

<blockquote class="option-quote">
The objective of a trader is to preceive opportunities available, not the threat of pain.
</blockquote>

&nbsp;

<blockquote class="option-quote">
Our minds are inherently designed to link external information with things we have already preceived in our internal mental environment
</blockquote>

这很好用,但现在我希望能够通过在引用旁边放置星号来强调特定引用,以表明它很重要。这是我尝试使用 Microsoft Paint 获得的模型:

添加的星号应位于块引用的左侧。我查看了Put a Star notation in html,它使用&lt;span&gt; 生成了一颗星,但目前,我只能将它放在块引用的上方或右侧。

<span class="red-star">★</span>
<blockquote class="option-quote">
Risk is relative, one's perception of risk is different from anothers.
</blockquote>

<blockquote class="option-quote">
<span class="red-star">★</span> Risk is relative, one's perception of risk is different from anothers.
</blockquote>

如何将星号放在块引用的左侧?此外,如果它是一个非常重要的报价,我希望能够生成多颗星,比如 3 颗星。谢谢!

【问题讨论】:

    标签: javascript html css alignment


    【解决方案1】:

    您可以使用以下 HTML 代码实现该结果:

    <blockquote>
       <span>★</span>
       <p>Risk is relative, one's ...</p>
    </blockquote>
    

    还有这个 CSS 代码:

    blockquote {
      display: flex;
      align-items: center;
      background: #eee;
      padding: 5px;
    }
    
    span {
      font-size: 2rem;
    }
    
    blockquote p {
      border-left: 5px solid grey;
      margin: 10px;
      padding: 10px;
    }
    

    你是Codepen example,它给出了这个结果:

    【讨论】:

    • 非常感谢我所需要的
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-02-05
    • 2015-09-18
    • 1970-01-01
    • 1970-01-01
    • 2016-08-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多