Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the github logo implemented with HTML as a font? [closed]

Can anyone explain how the small octocat logo in the top left corner or on the bottom center of the page is implemented and why?

All I can see is this markup:

<span class="mega-icon mega-icon-blacktocat"></span>

and this CSS:

.mega-icon-blacktocat:before {
    content: "";
}

.mega-icon {
font-family: 'Octicons Regular';
}

I see no picture there, so I guess they're using the font. But why is there that strange  character and why is it in the style and not in the HTML?

like image 716
Oin Avatar asked Feb 18 '23 10:02

Oin


1 Answers

It's a technique called CSS Fonts, they are using the font to replace the  text with a full icon, which will be in the font file they created.

It allows for the logo to scale infinitely with the site depending on resolution and tends to reduce load time. They can also change the colour and apply other cool CSS rules to it, unlike an image.

Things such as Pictos and Picons are similar as they offer a font where you can use the letter H to show a pie chart for example.

like image 136
Ryan McDonough Avatar answered Feb 22 '23 04:02

Ryan McDonough