i have added two icons from google fonts but however it seems to me that only one works at the time the two icons are the hamburger icon for my nav and the close icon
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="styles.css">
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" rel="stylesheet" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&icon_names=close" />
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&icon_names=menu" />
</head>
that is my head section
<nav class="navbar">
<a href="#" class="logo">Coffee <span>.</span></a>
<ul class="menu-links">
<span id="close" class="material-symbols-outlined">close</span>
<li><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Testimonials</a></li>
<li><a href="#">About Us </a></li>
<li><a href="#">Contact us</a></li>
</ul>
<span id="menu-btn" class="material-symbols-outlined">menu</span>
</nav> '
the two span inside my nav would be my icons
2
Answers
You only need to link to one google font stylesheet. To include two or more icons, pass them as a comma separated list after the
icon_names
parameter:In addition to jpneey’s answer explaining the correct application of a comma separated
icon_names
query parameter:You only see the second icon (menu) because the second query will take precedence as the crucial font properties –
font-family
,font-weight
,font-style
; are identical:1. close icon
2. menu icon
The
icon_names
query parameter is just an abstraction – optimized for Material icons – for the common google font APItext
query parameter (used for custom character based substitutions). The actual font-loading is based on the returned CSS@font-face
rule.The API request
https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&icon_names=close
translates to:opsz:24
– optical size axis value of 24wght:400
– weight 400 (regular)FILL:0
– take outline/non-solid design variantGRAD:0
– similar to weight but more comparable to ascale
transformation to emphasize certain iconsicon_names:close
– only include the close iconIf you concatenate all required icons in the
icon_names
parameter the API returns a suitable subset – only including the specified icon names.