简体   繁体   English

如何创建这样的文本效果 (HTML/ CSS)? 带插入符的文本

[英]How to create text effect like this (HTML/ CSS)? Text with caret

带插入符的文本

Not sure how to do this with just HTML/CSS.不确定如何仅使用 HTML/CSS 来执行此操作。 Should I use an image for the caret and top wording and insert it that way?我应该使用图像作为插入符号和顶部措辞并以这种方式插入吗?

 span::before { content: "∨"; position: absolute; left: 1em; top: 1.2em; }
 <span>text</span>

You may have to edit the positioning to get it in the right spot, but the key here is using a before pseudo-element with content: "∨" .您可能需要编辑定位以使其位于正确的位置,但这里的关键是使用content: "∨"before伪元素。

Can you try something like this, for pure CSS?对于纯 CSS,你能尝试这样的事情吗?

<div class='parent'>
    <div class='caret'>v</div>
    <div class='added-text'>a lot of</div>
    <div class='main-text'>Save  time with a quick solution</div>
</div>

.parent {
    position: absolute;
}

.added-text {
    padding-left: 10px;
}

.main-text {
}

.caret {
    position: absolute;
    top: 15px;  <-- might need some custom tuning
    left: 24px; <-- might need some custom tuning
}

Without sharing any details or what you have done so far, it leaves infinite options.在不分享任何细节或您到目前为止所做的事情的情况下,它留下了无限的选择。 Here's one.这是一个。

 p { font-family: Arial, sans-serif; font-size: 36px; margin-top: 50px; position: relative; } span { position: absolute; left: 15px; top: -60px; } span::before { content: "\2228"; color: #00f; font-size: 50px; left: 62px; position: relative; top: 32px; }
 <p>Save <span>a lot of </span> &nbsp;time with a quick solution</p>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM