Phil Young
Phil Young

Reputation: 1364

Inserting non-ASCII characters using the :before pseudo element

I have an input field inside a span, so that I can put a pound sign before all input fields in a span with the priceField class. However, because the pound symbol is a special character, I can't get it to render properly. I have tried the ascii dec and hex values, the html number & name and the actual symbol. Everything apart from the symbol print out the actual code, whereas the symbol outputs £.

Here is my current css:

#productEditForm .priceField:before {
    position:relative;
    display: block;
    float: left;
    content: "£";
    margin: 9px 4px 9px 2px;
    color: #075946;
}​

Any ideas?

Upvotes: 0

Views: 1378

Answers (2)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201708

You can fix the character encoding mismatch (more info would be needed for instructions on how to do that), or you can use the construct "\a3" instead of "£".

Upvotes: 5

Madara's Ghost
Madara's Ghost

Reputation: 174987

There's a mismatch between the stylesheet encoding and your document encoding. Save both as UTF-8 (or another common encoding)

Upvotes: 3

Related Questions