I have a web page with a custom font in Arabic but numbers with that font appear in Arabic and not clear so I want to show it with Arial font (numbers only)?
I used that but not working :
#font-face {
font-family: Arial, Helvetica, sans-serif !important;
src: local("Arial"), local("Arial");
font-style: normal;
unicode-range: U+30-39;
}
You need to name your unicode-range specific font.
In sort I am instructing the browser to use test font for all applied glyphs, then fallback to Ballet
#import url('https://fonts.googleapis.com/css2?family=Ballet&display=swap');
#font-face {
font-family: 'test';
src: local("Arial");
font-style: normal;
unicode-range: U+30-39;
}
p {
font-size: 4em;
font-family: test, 'Ballet', cursive;
}
<p>Hi there! 1 2 3 4 5</p>
If I understand correctly you have to set the unicode-range to the #font-face declaration and then specify the font-family for the element (body, ...) where this font should be used:
I created two examples, one with arial and helvetica mixed and one with arial + Comic Sans MS mixed, since this is easier to see.
#font-face {
font-family: 'myNumbers';
src: local('Arial');
unicode-range: U+30-39;
}
p {
font-size: 2em;
}
.mixed {
font-family: myNumbers, Helvetica;
}
.mixedComic {
font-family: myNumbers, 'Comic Sans MS';
}
.arial {
font-family: Arial;
}
.helvetica {
font-family: Helvetica
}
<p class="mixed">
Hello, I am 123 and 456 with Arial for Numbers and Helvetica for Text
</p>
<p class="mixedComic">
Hello, I am 123 and 456 with Comic Sans MS as Text and Arial for Numbers
</p>
<p class="arial">
Hello, I am 123 and 456 in arial only
</p>
<p class="helvetica">
Hello, I am 123 and 456 in helvetica only
</p>
Related
Imagine that I only have control through CSS. HTML is generated automatically, so I cannot add JS or change the HTML.
/*!
* Font Awesome Free 5.13.0 by #fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons:CC BY 4.0, Fonts:SIL OFL 1.1, Code:MIT License)
*/
#font-face {
font-family: 'my_font_awesome';
font-style: normal;
font-weight: 900;
font-display: auto;
src: url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-solid-900.eot);
src: url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-solid-900.eot?#iefix) format('embedded-opentype'), url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-solid-900.woff2) format('woff2'), url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-solid-900.woff) format('woff'), url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-solid-900.ttf) format('truetype'), url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-solid-900.svg#fontawesome) format('svg');
}
#btn_apple:before,
#btn_check:before,
#btn_facebook:before,
#btn_plus:before {
font-family: 'my_font_awesome';
margin-right: .6rem;
margin-left: 1rem;
}
#btn_apple:before {content:'\f179'}
#btn_check:before {content:'\f00c'}
#btn_facebook:before {content:'\f082'}
#btn_plus:before {content:'\f067'}
<a id="btn_apple">Apple</a>
<a id="btn_check">Check</a>
<a id="btn_facebook">Facebook</a>
<a id="btn_plus">Plus</a>
https://jsfiddle.net/johnlasantos/o1thrzxv/12/
You need to generate a new font for the brand icons because they don't belong to the same group as the solid one. Then you can simply use both font together and the browser will pick the needed one:
/*!
* Font Awesome Free 5.13.0 by #fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons:CC BY 4.0, Fonts:SIL OFL 1.1, Code:MIT License)
*/
#font-face {
font-family: 'my_font_awesome';
font-style: normal;
font-weight: 900;
font-display: auto;
src: url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-solid-900.eot);
src: url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-solid-900.eot?#iefix) format('embedded-opentype'), url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-solid-900.woff2) format('woff2'), url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-solid-900.woff) format('woff'), url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-solid-900.ttf) format('truetype'), url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-solid-900.svg#fontawesome) format('svg');
}
#font-face {
font-family: 'my_font_awesome_b';
font-style: normal;
font-weight: 400;
font-display: auto;
src: url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-brands-400.eot);
src: url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-brands-400.eot?#iefix) format('embedded-opentype'), url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-brands-400.woff2) format('woff2'), url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-brands-400.woff) format('woff'), url(https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-brands-400.ttf) format('truetype'), url(https://use.fontawesome.com/releases/v5.13.0/webfonts/ffa-brands-400.svg#fontawesome) format('svg');
}
#btn_apple:before,
#btn_check:before,
#btn_facebook:before,
#btn_plus:before {
font-family: 'my_font_awesome','my_font_awesome_b';
margin-right: .6rem;
margin-left: 1rem;
}
#btn_apple:before {content:'\f179'}
#btn_check:before {content:'\f00c'}
#btn_facebook:before {content:'\f082'}
#btn_plus:before {content:'\f067'}
<a id="btn_apple">Apple</a>
<a id="btn_check">Check</a>
<a id="btn_facebook">Facebook</a>
<a id="btn_plus">Plus</a>
More details from the Documentation: https://fontawesome.com/how-to-use/on-the-web/setup/hosting-font-awesome-yourself#using-certain-styles
Related question: Font Awesome 5 Choosing the correct font-family in pseudo-elements
My problem is very simple and the symptom is weird.
In the head of my HTML, I have included the code to load the font directly from Google Font.
<link href="https://fonts.googleapis.com/css?family=Roboto:700" rel="stylesheet">
And this is my CSS:
.text {
font-family: 'Roboto', sans-serif;
color: white;
font-size: large;
}
No matter what customization I choose, the font seems to be the normal font. I tried with Roboto Thin (Roboto:100) and Roboto Thin Italic (Roboto:100i) but none of them actually change.
Is there anything that I miss in my code?
It depends on which font you have from google, in this case:
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet">
You approach to each font weight in CSS like that:
// 300 weight
.text {
font-family: 'Roboto', sans-serif;
font-weight: 300;
}
// 400 weight
.text {
font-family: 'Roboto', sans-serif;
font-weight: 400;
}
// 700 weight
.text {
font-family: 'Roboto', sans-serif;
font-weight: 700;
}
You are loading Roboto font with 700 font weight and trying to show it with 100 font weight. Embed it with the following URL:
<link href="https://fonts.googleapis.com/css?family=Roboto:100,100i,400,700" rel="stylesheet">
Using this link, it will work fine for you.
Update: This code snippet will explain you it in detail.
.text {
font-family: 'Roboto', sans-serif;
color: #000;
}
.text-100 {
font-weight: 100;
}
.text-100i {
font-weight: 100;
font-style: italic;
}
.text-400 {
font-weight: 400;
}
.text-700 {
font-weight: 700;
}
<link href="https://fonts.googleapis.com/css?family=Roboto:100,100i,400,700" rel="stylesheet">
<div class="text text-100">
Hello (Font weight: 100)
</div>
<div class="text text-100i">
Hello (Font weight: 100i)
</div>
<div class="text text-400">
Hello (Font weight: 400)
</div>
<div class="text text-700">
Hello (Font weight: 700)
</div>
You simply need to set the font of your weight in your CSS
.text {
font-weight: 700;
}
First of all load all the fonts-
Just use
font-weight: 100|300|700 /Any one of them/ .
Google fonts basically work with font-weight property. The google fonts are rendered according to the font weight specifications.
For example-
Case 1 - font-weight:100 then thin font will load.
Case 2 - font-weight:300 then light font will load.
Case 3 - font-weight:700 then bold font will load.
In your css file, add:
#import url('https://fonts.googleapis.com/css?family=Roboto:400,700');
at the top.
And, user it in the desired class like:
.class{
font-family: 'Roboto', sans-serif;
font-weight: 700;
}
When I put in a <h1> tag, the text looks like it has been bolded.
How do we make text thinner in CSS?
Adjust your font-weight value: https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
font-weight: normal
font-weight: bold
font-weight: lighter
font-weight: bolder
font-weight: 100
font-weight: 200
font-weight: 300
font-weight: 400
font-weight: 500
font-weight: 600
font-weight: 700
font-weight: 800
font-weight: 900
font-weight: inherit
CSS font-weight will do the trick. Here are some examples:
.font-weight-200 {
font-weight: 200;
}
.font-weight-300 {
font-weight: 300;
}
.font-weight-400 {
font-weight: 400
}
.font-weight-500 {
font-weight: 500
}
.font-weight-600 {
font-weight: 600
}
.font-weight-700 {
font-weight: 700
}
.font-weight-800 {
font-weight: 800
}
.font-weight-900 {
font-weight: 900
}
<h1 class="font-weight-200">font-weight: 200</h1>
<h1 class="font-weight-300">font-weight: 300</h1>
<h1 class="font-weight-400">font-weight: 400</h1>
<h1 class="font-weight-500">font-weight: 500</h1>
<h1 class="font-weight-600">font-weight: 600</h1>
<h1 class="font-weight-700">font-weight: 700</h1>
<h1 class="font-weight-800">font-weight: 800</h1>
<h1 class="font-weight-900">font-weight: 900</h1>
Read the MDN docs: https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
Alternativly, you can just scale up a <p></p>. Example:
p {
font-size: 2rem;
}
<p class="thin-header">Some big thin text</p>
In case you didn't know, 2rem is 2 times the root font size, 3rem is 3 times the font-size, and so on.
Use font-weight:
div{/*pick your selector*/
font-weight: normal;
}
<p class="thin-text">Some text</p>
<style type="text/css">
.thin-text {
font-weight: 100;
}
</style>
Or, in-line:
<p style="font-weight: 100;">Some text</p>
I am having issues formatting any block elements with an embedded font in Safari and Chrome on a Mac.
Formatting is correct for all windows browsers (IE, Firefox, Chrome even Safari), and the font correctly displays for inline elements. I have stripped the html to just the following basics and still having this issue - What am I missing ??
#font-face { font-family: yowieFont; src: url(/template/GROBOLD.ttf); font-weight:normal; font-style:normal; font-variant:normal;}
h1 { font-family: yowieFont; color: #ed2249;}
h2 { font-family: yowieFont; color: #ed2249;}
h3 { font-family: yowieFont; color: #ed2249;}
p { font-family: yowieFont; color: #ed2249;}
span { font-family: yowieFont; color: #ed2249;}
<h1 style="display: inline;">1: CONTACT US</h1>
<h1 >1: CONTACT US</h1>
<h2 >2: CONTACT US</h2>
<h3 >3: CONTACT US</h3>
<p >P: CONTACT US</p>
<span>span: CONTACT US</span>
I resolved this issue by running the font through the font squirrel tool:
fontsquirrel.com/tools/webfont-generator
The tool generated the differing web formats required and fixed the line-height issues I was also having with this font
#font-face {
font-family: 'yowieFont';
src: url('/template/grobold-webfont.eot');
src: url('/template/grobold-webfont.eot?#iefix') format('embedded-opentype'),
url('/template/grobold-webfont.woff') format('woff'),
url('/template/grobold-webfont.ttf') format('truetype'),
url('/template/grobold-webfont.svg#groboldmedium') format('svg');
font-weight: normal;
font-style: normal;
}
hello friends i need to change font family and size in FCKEditor 4.2 but i very search and i not found solution for this problem in version 4.2 ckeditor.
At end of i found solution with replace css class .
put css class here for friend's that have similar problem and I hope helping them.
Thanks.
/*cke dialog label*/
.cke_dialog_ui_labeled_label {font-family: Tahoma; font-size:11px;}
/*cke dialog title*/
.cke_dialog_title {font-family: Tahoma; font-size:12px;}
/*cke dialog tab*/
.cke_dialog_tab {font-family: Tahoma; font-size:11px;}
/*cke input:text*/
.cke_dialog_ui_labeled_content {font-family: Tahoma; margin-top:5px; margin-bottom:5px;}
/*cke dialog input text*/
.cke_dialog_ui_input_text { font-family: Tahoma; font-size:12px;}
.cke_dialog_ui_button {font-family: Tahoma; font-size:12px;}
/*cke dialog select*/
.cke_dialog_ui_input_select {font-family: Tahoma; font-size:11px; }
.cke_dialog_ui_input_select option {font-family: Tahoma; font-size:11px; margin-top:2px; }
/*cke ui button text*/
.cke_combo_text { font-family: Tahoma; font-size:11px;}
http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-extraPlugins
In config.js, for example changing to classes, add the following:
Display Name/Class
config.font_names =
'Arial/arial;' +
'Comic Sans MS/comic_sans;' +
'Courier New/courier_new;' +
'Georgia/georgia;' +
'Lucida Sans Unicode/lucida;' +
'Tahoma/tahoma;' +
'Times New Roman/times_new_roman;' +
'Trebuchet MS/trebuchet;' +
'Verdana/verdana';
config.font_style = {
element: 'span',
attributes: {'class': '#(family)'}
};
OR
config.font_names = 'Arial/Arial, Helvetica, sans-serif;' +
'Comic Sans MS/Comic Sans MS, cursive;' +
'Courier New/Courier New, Courier, monospace;' +
'Georgia/Georgia, serif;' +
'Lucida Sans Unicode/Lucida Sans Unicode, Lucida Grande, sans-serif;' +
'Tahoma/Tahoma, Geneva, sans-serif;' +
'Times New Roman/Times New Roman, Times, serif;' +
'Trebuchet MS/Trebuchet MS, Helvetica, sans-serif;' +
'Verdana/Verdana, Geneva, sans-serif';
Change the inline styles.