1

I want to only target this specific sentence (Starting at $2.00 / frame.) in a paragraph to apply CSS and it has to remain in the same line but when using other elements it skips one line.

<p>Assorted frames made of different material, including MDF, birchwood, and PDE. Select frames can be sanded and painted according to your needs. Starting at $2.00 / frame.</p>

Any help would be appreciated.

Nima
  • 996
  • 2
  • 9
  • 37
  • Does this answer your question? [HTML: Changing colors of specific words in a string of text](https://stackoverflow.com/questions/4622808/html-changing-colors-of-specific-words-in-a-string-of-text) – disinfor Aug 16 '21 at 13:48

2 Answers2

2

Perhaps you could put them inside of a span tag because it is an inline element and will not change the behaviour of the whole line. Then you can target the span however you want or putting a class on that span or selecting it as a child from that paragraph.

How it was useful.

<p>Your text here <span class"special-text">Starting at $2.00 / frame.</span> more text </p>

then on CSS

.special-text{
  your styling
}

or

p > .special-text{
  your styling
}
Koulinn
  • 21
  • 2
1

Just wrap your targeted element in span tag and apply style.

p .highlight {
  color: red;
  font-weight: bold;
}
<p>Assorted frames made of different material, including MDF, birchwood, and PDE. Select frames can be sanded and painted according to your needs. Starting at <span class="highlight"> $2.00 / frame. </span> </p>

[Note] Change style according to your need.

Kunal Tanwar
  • 1,209
  • 1
  • 8
  • 23
  • 1
    but it will change all span property inside p it's better make a class or call it inside those span in which it needed. –  Aug 15 '21 at 05:25