Displaying the Indian currency symbol on a website
Easily display the Indian rupee symbol using the HTML entity ₹
. Adjust its appearance with CSS for layout and styling.
HTML example:
Ensure the symbol is supported by setting the correct font-family in CSS:
Then just apply the CSS class to your HTML tag:
Good practice: Always set your page character encoding to UTF-8:
Unicode, fonts, and testing
It is possible to use the rupee Unicode character U+20B9
or ₹
:
To ensure a uniform image across all devices, set a stylesheet specifying the appropriate fonts:
For a more stylish touch, we can use FontAwesome:
But don't forget to import FontAwesome:
Remember, not all devices will have the correct fonts installed, so provide alternatives to maximise compatibility.
Custom fonts & APIs
Geeking out on fonts? Sure! You can go beyond Arial and use Google Fonts:
Then specify the font in your CSS:
For standardised symbols, consider the WebRupee API:
And then simply add a class:
Compatibility and accessibility
Browser support isn't always perfect — sorry Internet Explorer fans (or should I add, all three of you?) 😉
Consistently test on different browsers and devices and ensure the rupee symbol is displayed correctly.
In some cases, FontAwesome or external APIs might not load. Here's where our superhero CSS font stack swoops in:
Use @font-face for fonts with the rupee symbol like a boss:
User experience and accessibility
The right font and showcasing method amplify the user experience, especially for visitors dealing in Indian currency.
For meaningful semantics, consider:
And boost accessibility with ARIA labels:
Remember: It's not a race, it's a marathon! Ensure your HTML validates to HTML5 standards.
Was this article helpful?