+ 4
How to change the font in html page ?
9 Answers
+ 19
<body style = "font-family: arial"></body>
Change "arial" with your font, cheers. :)
+ 6
* {
font-family: Arial;
}
/* This works as best */
+ 3
@Darsan Dev S
You can create CSS file includes the following code to set fonts:
/* Filename: fonts.css */
@font-face {
font-family: defaultFont; /* Name */
src: url(font_address.ttf); /* Path */
}
Then, import fonts in your main CSS page and use them using this code:
/* Main styles file (e. g. styles.css) */
/* Import fonts.css to use defaultFont */
@import "fonts.css";
/* Set all element fonts: */
* {
font-family: defaultFont, sans-serif;
/*
The second parameter of above line
is to set another font when defaultFont
not found.
*/
}
Notices:
Importing fonts is better because it prevents to code in every CSS file to set fonts.
@font-face is to set fonts that is on your server. The advantage is the fonts always working, even the user doesn't have them in his computer.
+ 2
@ujjwal pls tell me how to link font
+ 2
@Darsan Dev S
Didn't understand?
+ 1
<head>
<style>
p{
font-family: Arial,Serif;
}
</style>
</head>
/* If the browser don't read arial it will read Serif
*/
+ 1
you can link font to webpage using link element
many font are in website google font
take from there and link to your webpage and use it
+ 1
I just started to study css.