Font family does not change in the output
In the < h1 > tag, when I change any font family for any block of text (or a division), and open it in the browser, the font-family does not change. There is no change at all in h1, that I had applied it to.
Following is my HTML code:
<h1 align="center" class="login">
LOG IN</h1><hr /><br />
This is my CSS code:
.login
{
color:Black;
font-family:Calibri;
font-size:xx-large;
font-weight: bold;
}
The output that I get is as follows:

I changed the font to Calibri also. But, no change was reflected. The output always shows the same font family. I do not understand, where the problem could be?
html css fonts
|
show 2 more comments
In the < h1 > tag, when I change any font family for any block of text (or a division), and open it in the browser, the font-family does not change. There is no change at all in h1, that I had applied it to.
Following is my HTML code:
<h1 align="center" class="login">
LOG IN</h1><hr /><br />
This is my CSS code:
.login
{
color:Black;
font-family:Calibri;
font-size:xx-large;
font-weight: bold;
}
The output that I get is as follows:

I changed the font to Calibri also. But, no change was reflected. The output always shows the same font family. I do not understand, where the problem could be?
html css fonts
have you defined the font family that you are adding by@font-face?
– Muhammad Usman
Jan 27 '14 at 13:19
1
Try with another font if it doesn't work you might have other css rules which take precedence over this one and overrule it. Can you link to a jsFiddle that recreates this?
– Lior
Jan 27 '14 at 13:19
Can you try "font-family:"Times New Roman",Times,serif;" to see if it's working? I suspect there is an override going on in your css file.
– Minelava
Jan 27 '14 at 13:20
yes i try times new roman and other fonts instead of calibiri but it does not work
– user3134694
Jan 27 '14 at 13:24
@RanaMuhammadUsman how i defined?
– user3134694
Jan 27 '14 at 13:25
|
show 2 more comments
In the < h1 > tag, when I change any font family for any block of text (or a division), and open it in the browser, the font-family does not change. There is no change at all in h1, that I had applied it to.
Following is my HTML code:
<h1 align="center" class="login">
LOG IN</h1><hr /><br />
This is my CSS code:
.login
{
color:Black;
font-family:Calibri;
font-size:xx-large;
font-weight: bold;
}
The output that I get is as follows:

I changed the font to Calibri also. But, no change was reflected. The output always shows the same font family. I do not understand, where the problem could be?
html css fonts
In the < h1 > tag, when I change any font family for any block of text (or a division), and open it in the browser, the font-family does not change. There is no change at all in h1, that I had applied it to.
Following is my HTML code:
<h1 align="center" class="login">
LOG IN</h1><hr /><br />
This is my CSS code:
.login
{
color:Black;
font-family:Calibri;
font-size:xx-large;
font-weight: bold;
}
The output that I get is as follows:

I changed the font to Calibri also. But, no change was reflected. The output always shows the same font family. I do not understand, where the problem could be?
html css fonts
html css fonts
edited Sep 2 '18 at 17:27
ThePerson
533321
533321
asked Jan 27 '14 at 13:15
user3134694user3134694
251314
251314
have you defined the font family that you are adding by@font-face?
– Muhammad Usman
Jan 27 '14 at 13:19
1
Try with another font if it doesn't work you might have other css rules which take precedence over this one and overrule it. Can you link to a jsFiddle that recreates this?
– Lior
Jan 27 '14 at 13:19
Can you try "font-family:"Times New Roman",Times,serif;" to see if it's working? I suspect there is an override going on in your css file.
– Minelava
Jan 27 '14 at 13:20
yes i try times new roman and other fonts instead of calibiri but it does not work
– user3134694
Jan 27 '14 at 13:24
@RanaMuhammadUsman how i defined?
– user3134694
Jan 27 '14 at 13:25
|
show 2 more comments
have you defined the font family that you are adding by@font-face?
– Muhammad Usman
Jan 27 '14 at 13:19
1
Try with another font if it doesn't work you might have other css rules which take precedence over this one and overrule it. Can you link to a jsFiddle that recreates this?
– Lior
Jan 27 '14 at 13:19
Can you try "font-family:"Times New Roman",Times,serif;" to see if it's working? I suspect there is an override going on in your css file.
– Minelava
Jan 27 '14 at 13:20
yes i try times new roman and other fonts instead of calibiri but it does not work
– user3134694
Jan 27 '14 at 13:24
@RanaMuhammadUsman how i defined?
– user3134694
Jan 27 '14 at 13:25
have you defined the font family that you are adding by
@font-face ?– Muhammad Usman
Jan 27 '14 at 13:19
have you defined the font family that you are adding by
@font-face ?– Muhammad Usman
Jan 27 '14 at 13:19
1
1
Try with another font if it doesn't work you might have other css rules which take precedence over this one and overrule it. Can you link to a jsFiddle that recreates this?
– Lior
Jan 27 '14 at 13:19
Try with another font if it doesn't work you might have other css rules which take precedence over this one and overrule it. Can you link to a jsFiddle that recreates this?
– Lior
Jan 27 '14 at 13:19
Can you try "font-family:"Times New Roman",Times,serif;" to see if it's working? I suspect there is an override going on in your css file.
– Minelava
Jan 27 '14 at 13:20
Can you try "font-family:"Times New Roman",Times,serif;" to see if it's working? I suspect there is an override going on in your css file.
– Minelava
Jan 27 '14 at 13:20
yes i try times new roman and other fonts instead of calibiri but it does not work
– user3134694
Jan 27 '14 at 13:24
yes i try times new roman and other fonts instead of calibiri but it does not work
– user3134694
Jan 27 '14 at 13:24
@RanaMuhammadUsman how i defined?
– user3134694
Jan 27 '14 at 13:25
@RanaMuhammadUsman how i defined?
– user3134694
Jan 27 '14 at 13:25
|
show 2 more comments
3 Answers
3
active
oldest
votes
Define your font first
@font-face{
font-family:My Font;
src: url(fonts/myfont.ttf)
}
h1{font-family:"My Font"}
in css??????????
– user3134694
Jan 27 '14 at 13:39
In your CSS, yes. at the very top
– TheYaXxE
Jan 27 '14 at 14:16
and what is .ttf?
– user3134694
Jan 27 '14 at 17:38
create a folder called "fonts", download the font from the internet (his extension is .ttf), put it in that folder
– Lilia
Jan 1 '18 at 11:32
add a comment |
You should first test your rule with a normal web-safe font like "Arial", this is the list of web-safe fonts:
http://www.w3schools.com/cssref/css_websafe_fonts.asp
If that works then the problem is probably like Rana proposed, and you should add a font-face definition rule:
http://www.w3schools.com/cssref/css3_pr_font-face_rule.asp
If the normal web-safe fonts still don't work, you might have another rule, which is stronger, overriding this one.
You can check that by inspecting that element in your browser (Chrome's devtools are best for this) and looking at your rule and seeing if it as a line striking it (meaning it's not used and the browser is ignoring it), something like this (just your rule instead of the background position rule):

Also, an easy way to test for this will be to try and add the !important keyword to the above rule to give it higher precedence than other rules.
.login {
color: Black;
font-family: Arial !important;
font-size: xx-large;
font-weight: bold;
}
So it'll look something like this in Chrome's devtools:

You can find more about this keyword and the whole cascading-precedence system that css implements here:
http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/
(Images taken from this blog post:)
add a comment |
The Calibri-font should work, if you're working on a newer PC or MAC.
If the @font-face doesn't work, there must be some code, which overwrites the h1 styling.
Try to locate if there is something else that overwrite the styling.
Else try to rename your .login with: h1.login:
So instead of:
.login {
color:Black;
font-family:Calibri;
font-size:xx-large;
font-weight: bold;
}
Use:
h1.login {
color:Black;
font-family:Calibri;
font-size:xx-large;
font-weight: bold;
}
Not completely true, especially on Macs and Windows older than Vista, not all machines will support Calibri as its an office font.. cssfontstack.com
– Lior
Jan 27 '14 at 14:32
but h1 is not one in project i use h1 in many places so when i use this way ..where h1 places all h1 get this style but i want only in specifically not all in places where h1 is
– user3134694
Jan 27 '14 at 17:18
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21381909%2ffont-family-does-not-change-in-the-output%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Define your font first
@font-face{
font-family:My Font;
src: url(fonts/myfont.ttf)
}
h1{font-family:"My Font"}
in css??????????
– user3134694
Jan 27 '14 at 13:39
In your CSS, yes. at the very top
– TheYaXxE
Jan 27 '14 at 14:16
and what is .ttf?
– user3134694
Jan 27 '14 at 17:38
create a folder called "fonts", download the font from the internet (his extension is .ttf), put it in that folder
– Lilia
Jan 1 '18 at 11:32
add a comment |
Define your font first
@font-face{
font-family:My Font;
src: url(fonts/myfont.ttf)
}
h1{font-family:"My Font"}
in css??????????
– user3134694
Jan 27 '14 at 13:39
In your CSS, yes. at the very top
– TheYaXxE
Jan 27 '14 at 14:16
and what is .ttf?
– user3134694
Jan 27 '14 at 17:38
create a folder called "fonts", download the font from the internet (his extension is .ttf), put it in that folder
– Lilia
Jan 1 '18 at 11:32
add a comment |
Define your font first
@font-face{
font-family:My Font;
src: url(fonts/myfont.ttf)
}
h1{font-family:"My Font"}
Define your font first
@font-face{
font-family:My Font;
src: url(fonts/myfont.ttf)
}
h1{font-family:"My Font"}
answered Jan 27 '14 at 13:27
Muhammad UsmanMuhammad Usman
4,497186197
4,497186197
in css??????????
– user3134694
Jan 27 '14 at 13:39
In your CSS, yes. at the very top
– TheYaXxE
Jan 27 '14 at 14:16
and what is .ttf?
– user3134694
Jan 27 '14 at 17:38
create a folder called "fonts", download the font from the internet (his extension is .ttf), put it in that folder
– Lilia
Jan 1 '18 at 11:32
add a comment |
in css??????????
– user3134694
Jan 27 '14 at 13:39
In your CSS, yes. at the very top
– TheYaXxE
Jan 27 '14 at 14:16
and what is .ttf?
– user3134694
Jan 27 '14 at 17:38
create a folder called "fonts", download the font from the internet (his extension is .ttf), put it in that folder
– Lilia
Jan 1 '18 at 11:32
in css??????????
– user3134694
Jan 27 '14 at 13:39
in css??????????
– user3134694
Jan 27 '14 at 13:39
In your CSS, yes. at the very top
– TheYaXxE
Jan 27 '14 at 14:16
In your CSS, yes. at the very top
– TheYaXxE
Jan 27 '14 at 14:16
and what is .ttf?
– user3134694
Jan 27 '14 at 17:38
and what is .ttf?
– user3134694
Jan 27 '14 at 17:38
create a folder called "fonts", download the font from the internet (his extension is .ttf), put it in that folder
– Lilia
Jan 1 '18 at 11:32
create a folder called "fonts", download the font from the internet (his extension is .ttf), put it in that folder
– Lilia
Jan 1 '18 at 11:32
add a comment |
You should first test your rule with a normal web-safe font like "Arial", this is the list of web-safe fonts:
http://www.w3schools.com/cssref/css_websafe_fonts.asp
If that works then the problem is probably like Rana proposed, and you should add a font-face definition rule:
http://www.w3schools.com/cssref/css3_pr_font-face_rule.asp
If the normal web-safe fonts still don't work, you might have another rule, which is stronger, overriding this one.
You can check that by inspecting that element in your browser (Chrome's devtools are best for this) and looking at your rule and seeing if it as a line striking it (meaning it's not used and the browser is ignoring it), something like this (just your rule instead of the background position rule):

Also, an easy way to test for this will be to try and add the !important keyword to the above rule to give it higher precedence than other rules.
.login {
color: Black;
font-family: Arial !important;
font-size: xx-large;
font-weight: bold;
}
So it'll look something like this in Chrome's devtools:

You can find more about this keyword and the whole cascading-precedence system that css implements here:
http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/
(Images taken from this blog post:)
add a comment |
You should first test your rule with a normal web-safe font like "Arial", this is the list of web-safe fonts:
http://www.w3schools.com/cssref/css_websafe_fonts.asp
If that works then the problem is probably like Rana proposed, and you should add a font-face definition rule:
http://www.w3schools.com/cssref/css3_pr_font-face_rule.asp
If the normal web-safe fonts still don't work, you might have another rule, which is stronger, overriding this one.
You can check that by inspecting that element in your browser (Chrome's devtools are best for this) and looking at your rule and seeing if it as a line striking it (meaning it's not used and the browser is ignoring it), something like this (just your rule instead of the background position rule):

Also, an easy way to test for this will be to try and add the !important keyword to the above rule to give it higher precedence than other rules.
.login {
color: Black;
font-family: Arial !important;
font-size: xx-large;
font-weight: bold;
}
So it'll look something like this in Chrome's devtools:

You can find more about this keyword and the whole cascading-precedence system that css implements here:
http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/
(Images taken from this blog post:)
add a comment |
You should first test your rule with a normal web-safe font like "Arial", this is the list of web-safe fonts:
http://www.w3schools.com/cssref/css_websafe_fonts.asp
If that works then the problem is probably like Rana proposed, and you should add a font-face definition rule:
http://www.w3schools.com/cssref/css3_pr_font-face_rule.asp
If the normal web-safe fonts still don't work, you might have another rule, which is stronger, overriding this one.
You can check that by inspecting that element in your browser (Chrome's devtools are best for this) and looking at your rule and seeing if it as a line striking it (meaning it's not used and the browser is ignoring it), something like this (just your rule instead of the background position rule):

Also, an easy way to test for this will be to try and add the !important keyword to the above rule to give it higher precedence than other rules.
.login {
color: Black;
font-family: Arial !important;
font-size: xx-large;
font-weight: bold;
}
So it'll look something like this in Chrome's devtools:

You can find more about this keyword and the whole cascading-precedence system that css implements here:
http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/
(Images taken from this blog post:)
You should first test your rule with a normal web-safe font like "Arial", this is the list of web-safe fonts:
http://www.w3schools.com/cssref/css_websafe_fonts.asp
If that works then the problem is probably like Rana proposed, and you should add a font-face definition rule:
http://www.w3schools.com/cssref/css3_pr_font-face_rule.asp
If the normal web-safe fonts still don't work, you might have another rule, which is stronger, overriding this one.
You can check that by inspecting that element in your browser (Chrome's devtools are best for this) and looking at your rule and seeing if it as a line striking it (meaning it's not used and the browser is ignoring it), something like this (just your rule instead of the background position rule):

Also, an easy way to test for this will be to try and add the !important keyword to the above rule to give it higher precedence than other rules.
.login {
color: Black;
font-family: Arial !important;
font-size: xx-large;
font-weight: bold;
}
So it'll look something like this in Chrome's devtools:

You can find more about this keyword and the whole cascading-precedence system that css implements here:
http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/
(Images taken from this blog post:)
edited Jan 27 '14 at 14:19
answered Jan 27 '14 at 14:08
LiorLior
1,3411118
1,3411118
add a comment |
add a comment |
The Calibri-font should work, if you're working on a newer PC or MAC.
If the @font-face doesn't work, there must be some code, which overwrites the h1 styling.
Try to locate if there is something else that overwrite the styling.
Else try to rename your .login with: h1.login:
So instead of:
.login {
color:Black;
font-family:Calibri;
font-size:xx-large;
font-weight: bold;
}
Use:
h1.login {
color:Black;
font-family:Calibri;
font-size:xx-large;
font-weight: bold;
}
Not completely true, especially on Macs and Windows older than Vista, not all machines will support Calibri as its an office font.. cssfontstack.com
– Lior
Jan 27 '14 at 14:32
but h1 is not one in project i use h1 in many places so when i use this way ..where h1 places all h1 get this style but i want only in specifically not all in places where h1 is
– user3134694
Jan 27 '14 at 17:18
add a comment |
The Calibri-font should work, if you're working on a newer PC or MAC.
If the @font-face doesn't work, there must be some code, which overwrites the h1 styling.
Try to locate if there is something else that overwrite the styling.
Else try to rename your .login with: h1.login:
So instead of:
.login {
color:Black;
font-family:Calibri;
font-size:xx-large;
font-weight: bold;
}
Use:
h1.login {
color:Black;
font-family:Calibri;
font-size:xx-large;
font-weight: bold;
}
Not completely true, especially on Macs and Windows older than Vista, not all machines will support Calibri as its an office font.. cssfontstack.com
– Lior
Jan 27 '14 at 14:32
but h1 is not one in project i use h1 in many places so when i use this way ..where h1 places all h1 get this style but i want only in specifically not all in places where h1 is
– user3134694
Jan 27 '14 at 17:18
add a comment |
The Calibri-font should work, if you're working on a newer PC or MAC.
If the @font-face doesn't work, there must be some code, which overwrites the h1 styling.
Try to locate if there is something else that overwrite the styling.
Else try to rename your .login with: h1.login:
So instead of:
.login {
color:Black;
font-family:Calibri;
font-size:xx-large;
font-weight: bold;
}
Use:
h1.login {
color:Black;
font-family:Calibri;
font-size:xx-large;
font-weight: bold;
}
The Calibri-font should work, if you're working on a newer PC or MAC.
If the @font-face doesn't work, there must be some code, which overwrites the h1 styling.
Try to locate if there is something else that overwrite the styling.
Else try to rename your .login with: h1.login:
So instead of:
.login {
color:Black;
font-family:Calibri;
font-size:xx-large;
font-weight: bold;
}
Use:
h1.login {
color:Black;
font-family:Calibri;
font-size:xx-large;
font-weight: bold;
}
edited Jan 27 '14 at 14:36
answered Jan 27 '14 at 14:24
TheYaXxETheYaXxE
2,40721428
2,40721428
Not completely true, especially on Macs and Windows older than Vista, not all machines will support Calibri as its an office font.. cssfontstack.com
– Lior
Jan 27 '14 at 14:32
but h1 is not one in project i use h1 in many places so when i use this way ..where h1 places all h1 get this style but i want only in specifically not all in places where h1 is
– user3134694
Jan 27 '14 at 17:18
add a comment |
Not completely true, especially on Macs and Windows older than Vista, not all machines will support Calibri as its an office font.. cssfontstack.com
– Lior
Jan 27 '14 at 14:32
but h1 is not one in project i use h1 in many places so when i use this way ..where h1 places all h1 get this style but i want only in specifically not all in places where h1 is
– user3134694
Jan 27 '14 at 17:18
Not completely true, especially on Macs and Windows older than Vista, not all machines will support Calibri as its an office font.. cssfontstack.com
– Lior
Jan 27 '14 at 14:32
Not completely true, especially on Macs and Windows older than Vista, not all machines will support Calibri as its an office font.. cssfontstack.com
– Lior
Jan 27 '14 at 14:32
but h1 is not one in project i use h1 in many places so when i use this way ..where h1 places all h1 get this style but i want only in specifically not all in places where h1 is
– user3134694
Jan 27 '14 at 17:18
but h1 is not one in project i use h1 in many places so when i use this way ..where h1 places all h1 get this style but i want only in specifically not all in places where h1 is
– user3134694
Jan 27 '14 at 17:18
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21381909%2ffont-family-does-not-change-in-the-output%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
have you defined the font family that you are adding by
@font-face?– Muhammad Usman
Jan 27 '14 at 13:19
1
Try with another font if it doesn't work you might have other css rules which take precedence over this one and overrule it. Can you link to a jsFiddle that recreates this?
– Lior
Jan 27 '14 at 13:19
Can you try "font-family:"Times New Roman",Times,serif;" to see if it's working? I suspect there is an override going on in your css file.
– Minelava
Jan 27 '14 at 13:20
yes i try times new roman and other fonts instead of calibiri but it does not work
– user3134694
Jan 27 '14 at 13:24
@RanaMuhammadUsman how i defined?
– user3134694
Jan 27 '14 at 13:25