changing the color of a part of text in stylus css?
Asked Answered
L

3

8

i want to change the color of only one word in string of text using stylus i.e.

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

the stylus code is

  h1
   font-weight bold
   color white

i just want to change the color of the first letter in the h1 phrase "Our" into yellow how could i achieve that in stylus, thanks :)

Lieutenancy answered 11/7, 2012 at 10:6 Comment(0)
L
5

You can try the :first-letter selector:

h1:first-letter
    color: yellow

Here's a fiddle with an example.

Lengthy answered 11/7, 2012 at 10:9 Comment(0)
C
9

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

If you want to change other letters or parts of text as per your example, use a span with its own style, e.g.

<h1><span style="color:yellow">O</span>ur <span style="color:blue">new</span> website</h1>
Champagne answered 11/7, 2012 at 10:11 Comment(0)
L
5

You can try the :first-letter selector:

h1:first-letter
    color: yellow

Here's a fiddle with an example.

Lengthy answered 11/7, 2012 at 10:9 Comment(0)
A
1

This could be done by making use of Pseudo-elements

Fiddle

Arteaga answered 11/7, 2012 at 10:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.