Check out the live demonstration on Jsfiddle
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/css/materialize.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/js/materialize.min.js"></script>
<i class="material-icons">add</i>
<i class="material-icons">replay</i>
The aspect that puzzled me the most was the way icons were incorporated using the inner text of the <i>
element rather than a class attribute (such as
<i class="icon-add"></i>
or <i class="icon-reply"></i>
).
Upon inspecting the <i>
node in the Chrome developer tools, it appeared that they all looked similar and were difficult to differentiate through CSS selectors.
If the icon is determined by the inner text, how can different icons be assigned to these <i>
elements using CSS?
Another perplexing issue for me was understanding how these icons are executed (whether through icon fonts, PNG images, or SVG graphics). While it appears as if they are generated using an icon font
, I could not locate any CSS rule like:
.fa-flag:before {
content: "\f024";
}
If the icons are not created using the :before
selector and content
property, then how exactly are they implemented?