Hi dear welcome to "CodePrime" Blog . In this post we are going to learn How To add google font using html and css. First Creat A index.html file Copy This HTML CODE and pest it one your code editor. 2ndly creat style.css file Then Copy The CSS CODE and pest it then open the index.html file with your browser.
HTML CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="Google-font" href="https://fonts.googleapis.com/css2?family=Lato:ital@1&family=Open+Sans:wght@300&family=Roboto&display=swap">
<title>Google font by codeprime</title>
</head>
<body>
<button>CodePrime - Bangladesh-1</button>
<button>CodePrime - Bangladesh-2</button>
<button>CodePrime - Bangladesh-3</button>
</body>
</html>
CSS CODE
@import url('https://fonts.googleapis.com/css2?family=Lato:ital@1&family=Open+Sans:wght@300&family=Roboto&display=swap');
button{
padding: 10px 20px;
margin: 10px 0;
font-family: 'Roboto', sans-serif;
}
button:nth-child(1){
font-family: 'Open Sans', sans-serif;
}
button:nth-child(2){
font-family: 'Lato', sans-serif;
}
body{
background: linear-gradient(45deg, blue, white);
display: flex;
flex-direction: column;
justify-content: center;
min-height: 100vh;
align-items: center;
text-align: center;
}
0 Comments