/    Sign up×
Community /Pin to ProfileBookmark

Styling a counter incremented number on an ordered list

Hi,

I’m not sure if this is even possible, but I thought I would ask to see if anyone knew.

I’ve recently come across the counter-increment property for css, which allows me to set a counter for my ordered list and allows my list items to say Step 1, step 2, step 3 etc.

The CSS is this:

[code]
body{
counter-reset: toc 0;
}

#toc li:before{
content: “Step ” counter(toc, decimal); /* This is the main Line */
counter-increment: toc;
font-size: 3.6em;
font-family: Helvetica Black;
color: #646464;
letter-spacing: -2px;
}

#toc li{
list-style-type: none;
}
[/code]

With the above I have managed to get the phrase “Step 1”, “Step 2”, “Step 3” styled as 3.6em Helvatica Black with a colour of #646464, BUT I want the word “Step” to be a different colour to the number. Does anyone know if this is possible?

Thanks

Phil

to post a comment
CSS

1 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Jun 23.2011 — Not as far as I'm aware while using the :before pseudo-class.
×

Success!

Help @scouse spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.11,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...