Since your example is taken from Material Icons, I'll answer to your question in this scope.
On a high level does the browser render the first example?
Let's start from the beginning:
<i class="material-icons">
share
</i>
Here, they use a <i>
element for icons (not a good idea). A CSS class is also set, material-icons
. Material Icons are designed in this CSS link:
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
Let's have a look on how this material-icon class is designed:
.material-icons {
font-family: 'Material Icons'; /* [...] */
}
"Material Icons" is a custom font, described in the same resource:
@font-face {
font-family: 'Material Icons';
/* [...] */
src: url(https://fonts.gstatic.com/s/materialicons/v46/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}
So you end up with the text "share"
displayed in a custom font, and that's the key of this feature. This is not an unicode character nor a "real" icon (SVG or bitmap), but an entire text displayed in a specific font to render it as an icon.
For example, in the below snippet, try to select "a part" of share icon, and you'll figure out this is actually the word "shared", drawn character per character. Copy and paste it elsewhere to see it. For example, the left spot stands for h
.
@font-face {
font-family: 'Material Icons';
src: url(https://fonts.gstatic.com/s/materialicons/v46/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}
.material-icons {
font-family: 'Material Icons';
font-size:24px;
}
<i class="material-icons">
share
</i>