Reputation: 1736
I need two following Unicode characters to have the same width in a web page: ▼ (▼) and ▶ (▶)
font-family: monospace;
does not help, they still get different width (Windows 8, Firefox 17):
Is there any way to let every (and not only usual letters) character on a page to have the same width?
Source code of the example:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>7
<body>
<h1 style="font-family: monospace;">
▼test
<br>
▶test
</h1>
</body>
</html>
Upvotes: 2
Views: 3314
Reputation: 6732
Put both characters in another tag (like <span>
) and give it a fixed width using CSS. Like this (working example):
<span style="display: inline-block; width: 30px;">▼</span>test
<br>
<span style="display: inline-block; width: 30px;">▶</span>test
Or choose a CSS only approach which I assume would be more decent (working example):
<span class="opened">test</span>
<br>
<span class="closed">test</span>
And the CSS code:
.opened::before {
display: inline-block;
content: "▼";
width: 30px;
}
.closed::before {
display: inline-block;
content: "▶";
width: 30px;
}
Upvotes: 4