CSS ikone
Ikone kan maklik by jou HTML-bladsy gevoeg word deur 'n ikoonbiblioteek te gebruik.
Hoe om ikone by te voeg
Die eenvoudigste manier om 'n ikoon by jou HTML-bladsy te voeg, is met 'n ikoonbiblioteek, soos Font Awesome.
Voeg die naam van die gespesifiseerde ikoonklas by enige inlyn HTML-element (soos <i>
of
<span>
).
Al die ikone in die ikoonbiblioteke hieronder is skaalbare vektore wat met CSS aangepas kan word (grootte, kleur, skaduwee, ens.)
Font Awesome ikone
Om die Font Awesome-ikone te gebruik, gaan na
fontawesome.com , meld aan en kry 'n kode om by te voeg in die <head>
afdeling van jou HTML-bladsy:
<script src="https://kit.fontawesome.com/yourcode.js" crossorigin="anonymous"></script>
Lees meer oor hoe om met Font Awesome te begin in ons Font Awesome 5-tutoriaal .
Let wel: Geen aflaai of installasie is nodig nie!
Voorbeeld
<!DOCTYPE html>
<html>
<head>
<script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script>
</head>
<body>
<i class="fas fa-cloud"></i>
<i class="fas fa-heart"></i>
<i class="fas fa-car"></i>
<i class="fas fa-file"></i>
<i class="fas fa-bars"></i>
</body>
</html>
Resultaat:
Vir 'n volledige verwysing van alle Font Awesome-ikone, besoek ons Icon Reference .
Bootstrap-ikone
Om die Bootstrap glyphicons te gebruik, voeg die volgende reël binne die <head>
gedeelte van jou HTML-bladsy by:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
Let wel: Geen aflaai of installasie is nodig nie!
Voorbeeld
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<i class="glyphicon glyphicon-cloud"></i>
<i class="glyphicon glyphicon-remove"></i>
<i class="glyphicon glyphicon-user"></i>
<i class="glyphicon glyphicon-envelope"></i>
<i class="glyphicon glyphicon-thumbs-up"></i>
</body>
</html>
Resultaat:
Google-ikone
Om die Google-ikone te gebruik, voeg die volgende reël binne die <head>
gedeelte van jou HTML-bladsy by:
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
Let wel: Geen aflaai of installasie is nodig nie!
Voorbeeld
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body>
<i class="material-icons">cloud</i>
<i class="material-icons">favorite</i>
<i class="material-icons">attachment</i>
<i class="material-icons">computer</i>
<i class="material-icons">traffic</i>
</body>
</html>
Resultaat:
Vir 'n volledige lys van alle ikone, besoek ons Ikoon Tutoriaal .