- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I’m building a site where my client is going to be regularly inputting prices. At the moment all they need to do is type in the price, and using the :before element I chuck a pound sign (£) in front of the number. This looks a little something like this:
.price:before {
content: ‘£’;
}
The problem I’m running into is some prices are prefixed with the word “from”, which as you might have guessed look a little like this:
£from 15
Is there a way to use the :before element before the first number using pure CSS?
Any help would be appreciated. Thanks in advance!
Basically…no.
You could do
.price:after {
content: ‘pounds’;
}
If I may, the currency is kind of an important part of the price thus it probably shouldn’t be inserted with CSS.
>If I may, the currency is kind of an important part of the price thus it probably shouldn’t be inserted with CSS.
Indeed, the symbol is content and should be part of the HTML…it’s not a style applied to the price.