Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the CSS content property with a Google Material Icon?

How can I insert the Google Material Icon "chevron icon right" (https://design.google.com/icons/#ic_chevron_right) in the following CSS content property:

.bullet li a:before {
    content: "";
}
like image 734
Max Avatar asked Oct 22 '16 15:10

Max


People also ask

How do I use Google material icon in CSS?

First step is to add the link of material-icons font library in the <head> section of your HTML file. Here is how you do it. Once you have added the link of the material-icons library, the next step is to add the class “material-icons” in the <i> or <span> tag of the <body> section and also add the name of the icon.

How do I use material icon code point?

See also Google's list: codepoints. To use a Material Icon as CSS pseudo content (:before, :after): xe23c becomes content:"\e23C" . You can use ligatures in pseudo elements, but this will not be supported in IE9. For more stuff, visit me at btn.

How do you use material design icons in HTML?

Using the Icon Google's Material Icons provides a long list of icons. Choose any one of them and add the name of the icon class to any HTML element within the < body > tag. In the following example, we have used the icon named accessibility that belongs to the action category.


3 Answers

Update on 2018

Google removed the codes which were displayed earlier for IE9 and below. To get the codes visit the codepoints file in the GitHub repository.

Link to codepoints in GitHub repository: https://github.com/google/material-design-icons/blob/master/font/MaterialIcons-Regular.codepoints


Step 1: Include the Material Icons Stylesheet.

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

Step 2 :

CSS Code:

.bullet li a:before {
    font-family: "Material Icons";
    content: "\e5cc";
}

Explanation: The value e5cc is the code which you see for the chevron.

enter image description here

like image 60
Sarvap Praharanayuthan Avatar answered Sep 16 '22 17:09

Sarvap Praharanayuthan


::before {
    font-family: 'Material Icons';
    content: "\E87C";
}

::after {
    font-family: 'Material Icons';
    content: "face";
}

http://codepen.io/estelle/pen/MwvOjd

like image 24
Daniel Delgado Avatar answered Sep 16 '22 17:09

Daniel Delgado


Try this.

.bullet li a:before {
    font-family: FontAwesome;
    content: "\f054";
}

You can refer here for content values

like image 21
Bhavin Shah Avatar answered Sep 19 '22 17:09

Bhavin Shah