Query: I've encountered difficulty in removing the whitespace around Google's Material Design icons, despite searching for solutions on Google and the Material Design icons guide. It's unclear whether the solution is simple and I'm overlooking it, or if there's a more complex reason for this seemingly straightforward task.
Below are excerpts from the relevant code in my project, or you can view the full project here.
My HTML markup:
<header class="primary-header first-header-column"> <i class="material-icons primary-header-material-icon-first-menu"> menu </i> <h1> <strong> Neocrypt </strong> Network </h1> <nav class="primary-header-navigation"> </nav> </header>
Icon styling:
.material-icons.primary-header-material-icon-first-menu { color: var(--primary-typeface-color); font-size: 48px; }
Heading styling:
.primary-header h1 { text-align: center; color: var(--primary-typeface-color); display: inline; font-family: var(--primary-typeface); font-size: 60px; line-height: 150px; }
Referenced variables:
:root { --primary-typeface-color: #ffffff; --primary-typeface: 'Lato', sans-serif; }
I'm aiming to have the icon sit directly beside the heading without any padding so I can adjust the spacing myself, like a reset. Despite attempting padding: 0px;
and other solutions, the issue persists.
Note: I'm implementing Eric Meyer's "Reset CSS," which, as far as I know, shouldn't impact Google's Material Design icons.
Update (24/03/2018 01:33 UTC): It appears that Google adds the spacing around the icon within the image file itself, limiting users' control over that spacing. For those facing a similar challenge, I suggest exploring alternative icon fonts like Font Awesome.