Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Resize Unicode Characters via CSS

Tags:

html

css

unicode

I have the following ul, which produces a square bullet that (without modification) is very slightly larger than the default square bullets in HTML.

li:before {
  content: "\25a0";
  margin-right: 6px;
  color: blue;          
}

Problems:

  1. I want to significantly increase the size of the square unicode-generated bullet.
  2. Also, the bullet is aligned to the bottom of the text instead of center aligned to the text.

Any clues on how to fix this?

like image 357
sleeper Avatar asked May 20 '14 03:05

sleeper


People also ask

How do I use Unicode characters in CSS?

To add a Unicode character to the CSS content property, you can do either of the following: Add a Unicode character directly, or; Use the Character's Hexadecimal Unicode Code Point Value.

What is Unicode range in CSS?

The unicode-range CSS descriptor sets the specific range of characters to be used from a font defined by @font-face and made available for use on the current page. If the page doesn't use any character in this range, the font is not downloaded; if it uses at least one, the whole font is downloaded.

How do you increase the size of the symbol in HTML?

You can adjust its size with font-size and font-stretch (although it has limited support). Keep in mind that the width will vary with the font family too. (Be careful not to use a greater than symbol when you actually want an arrow.)

How do I put Unicode before?

To insert a Unicode character, type the character code, press ALT, and then press X.


2 Answers

Please note that at least your fiddle behaves totally different across browsers !

You did not specify a font-family for the Unicode part. In the fiddle many Unicode characters will appear larger in Firefox, IE and Edge. Probably in all non-webkit browsers.

Add e.g.

font-family: "Lucida Sans Unicode", "Arial Unicode MS";

everywhere you want to use Unicode characters crossbrowser ...

You can read more about the differences in detail here: https://www.smashingmagazine.com/2014/05/unicode-for-a-multi-device-world/

like image 116
sebilasse Avatar answered Oct 19 '22 16:10

sebilasse


You need to add the below CSS properties to li:before

font-size: 128px;
vertical-align: middle;

You can change the 128px to any size you want.

Demo

like image 36
Raptor Avatar answered Oct 19 '22 16:10

Raptor