How to use Google fonts in ASP.NET

Using the right the font and right design UI elements makes your website look even more better. Google Open source Fonts are the collections of some of the best looking fonts on the web today. You can integrate these fonts for totally free of cost as they are open source and easy to use.

Also see : ASP.NET Custom Fonts using CSS

To integrate these fonts in ASP.NET project you will have to declare a link tag inside the head element of your html (.aspx) page as below :

<title>Custom Fonts</title>
<link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet'
type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet'
type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Bree+Serif' rel='stylesheet'
type='text/css'>

Then make stylesheet for using these fonts on your page :

<style type="text/css">
body
{
background-color: #3498db;
}
.label1
{
font-family: 'Montserrat' , sans-serif;
color: #fff;
font-size: 25px;
}
.button1
{
font-family: 'Poiret One' , cursive;
font-size: 25px;
color: #fff;
font-weight: bolder;
background-color: #34495e;
padding: 10px;
}
.textbox1
{
font-family: 'Bree Serif' , serif;
font-size: 25px;
color: #707070;
font-weight: bolder;
width:650px;
padding: 10px;
}
</style>

And then style your page elements :

<body>
<form id="form1" runat="server">
<div>
<asp:Label runat="server" ID="lbl1" CssClass="label1" Text="This Label is styled using Google Fonts - Montserrat"></asp:Label>
<br />
<br />
<asp:Button runat="server" CssClass="button1" Text="This Button is styled using Google Fonts - Poiret One" />
<br />
<br />
<asp:TextBox runat="server" CssClass="textbox1" ></asp:TextBox>
</div>
</form>
</body>

Google Fonts in ASP.NET

Thank You.

You can use Custom fonts in your Web application too. See this post on  ASP.NET Custom Fonts using CSS


1 thought on “How to use Google fonts in ASP.NET”

  1. Pingback: ASP.NET Custom Fonts using CSS • ParallelCodes();

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.