Reputation: 1
I tried to change the font to a <h1>
tag in bootstrap css; here is the
original code:
<h1 class="text-center"> My Site </h1>
I tried the following:
<h1 class="text-center" style=font-family: "Arial";> My Site </h1>
<h1 class="text-center" style=font-family: Aria;> My Site </h1>
However, none of which worked. I've tried with several basic fonts too, such as Verdana, Times New Roman, Courier etc.I very much appreciate it if someone can help me with my problem here.
Upvotes: 0
Views: 3631
Reputation: 3289
The short answer to your question is that your HTML is invalid. Here is the quick and dirty solution.
<h1 class="text-center" style="font-family: Arial;"> My Site </h1>
This is called inline styling and it's generally frowned upon for several reasons, but that's outside the scope of this question.
<h1 class="text-center" style=font-family: "Arial";> My Site </h1>
The quotes should contain all of the css in your style attribute. e.g., style="font-family: Arial;"
<h1 class="text-center" style=font-family: Aria;> My Site </h1>
Again, the quotes need to contain the style within your style attribute. It also looks like you dropped the "l" from "Arial" (typo).
Upvotes: 0
Reputation: 52
Try this one :
<h1 class="text-center" style="font-family: "Arial";"> My Site </h1>
Upvotes: 0
Reputation: 943108
HTML attributes values which are not delimited by quote characters cannot have spaces in them. Add quotes.
<h1 class="text-center" style="font-family: Arial;"> My Site </h1>
This would have been picked up if you have used a validator.
NB: A stylesheet is prefered over style attributes. You might want to read an introductory guide.
Upvotes: 1
Reputation: 313
The way you change a font in CSS is by doing this:
h1.t {
font-family: "Times New Roman", Times, serif;
}
h1.a {
font-family: "Arial", Helvetica, sans-serif;
}
h1.c {
font-family: "Calibri", Helvetica, sans-serif;
}
<h1 class="t">Times New Roman</h1>
<h1 class="a">Arial</h1>
<h1 class="c">Calibri</h1>
There you go, you just need to know the family information, and you didn't have all the family info in there.
Upvotes: 1