2
respostas

Quase desistindo porque meus ícones não aparecem

Aparentemente o caminho tá ok, mas ícones n aparecem.

O que será que tá errado?

index

<!DOCTYPE html>
<html lang="pt - br">
    <head>
         <title>HCZ | Home </title>
         <meta charset="UTF=8">
         <meta name="viewport" content="width=device-width,initial-scale=1">
         <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=Open+Sans:wght@400;600;700&display=swap">
         <link rel="stylesheet" href="css/reset.css">
         <link rel="stylesheet" href="css/estilos.css">

    </head>
    <body>
        <header class="cabecalho">
            <button class="cabecalho__menu"  aria-label="Menu"><i></i></button>
            <img src="img/logo.svg" alt="logotipo hcz" class="cabecalho__logo">
            <button class="cabecalho__notificao"  aria-label="Notificação"><i></i></button>
        </header>

    </body>
    </html>

css

@font-face {
    font-family: 'icones';
    src: url(/font/icones.ttf);
}


body    {
    background-color: #1D232A;
    font-family: 'Opens Sans','icones', sans-serif;

}
.cabecalho {

    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #15191C;
    padding: 8px 16px;
    box-shadow: 0px 4px 4px rgba(0,0,0,0,16);
}

.cabecalho__menu i::before {
    content: "\e904";
    font-size: 24px;
}

.cabecalho__notificao i::before {
    content: "\e906";
    font-size: 24px;
}
2 respostas

Olá Maria,

Dentro do "@font-face" mantenha igual que o professor passou. Ao final das classes utilize o "font-family: 'icones';", conforme abaixo:

.cabecalho__menu i::before { content: "\e904"; font-size: 24px; font-family: 'icones'; }

.cabecalho__notificacao i::before { content: "\e906"; font-family: 'icones'; }

Espero ter ajudado e bons estudos!

Quebrei a cabeça também com esse erro mas uma forma que deu certo para mim foi fazendo da seguinte forma:

@font-face { font-family: 'icones'; src: local('icones'), url("../font/icones.ttf") format('truetype'); }

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software