How to style only an excerpt of a text?

Asked

Viewed 2,501 times

1

I want to know how I can have a result like this in my text:

screenshot mostrando apenas uma parte de um parágrafo com cor diferente

I want to highlight certain excerpt and put in bold.

<p> A ferramenta é 100% online, desenvolvida com as mais modernas tecnologias </p>

2 answers

5


Use a span and a CSS class:

.destaque {
  font-weight: bold;
  color: #009933;
}
<p>A <span class="destaque">ferramenta é 100% online</span>, desenvolvida com as mais modernas tecnologias.</p>

Or the style directly on the tag (not recommended):

<span style="font-weight: bold;  color: #009933;">ferramenta é 100% online</span>
  • Thanks, Marcus! But is there a way to get it right there in span? Without using a CSS class...

  • <span style="font-weight: bold; color: #009933;">ferramenta é 100% online</span>

  • Thank you very much! ;)

5

You can use the Html5 Mark tag and customize its color, the mark tag is used to highlight a snippet and help with SEO

<style>
mark {
background-color:#009933; 
font-weight: bold; 
}
</style>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.