Changing the color of a piece of text in a css stylus?

I want to change the color of only one word in a line of text using the stylus ie

#copy h1 Our new site will be ready soon.. 

stylus code

  h1 font-weight bold color white 

I just want to change the color of the first letter in the phrase h1 "Our" to yellow, how can I achieve this in the stylus, thanks :)

+6
source share
3 answers

You can try : first-letter selector:

 h1:first-letter color: yellow 

The following is an example script with an example.

+3
source

The first-letter css selector selector is a good option.

If you want to change other letters or parts of the text to suit your example, use a range with your own style, e.g.

 <h1><span style="color:yellow">O</span>ur <span style="color:blue">new</span> website</h1> 
+5
source

This can be done using pseudo-elements.

Fiddle

+1
source

Source: https://habr.com/ru/post/920206/


All Articles