IE 11 doesn't process font declaration correctly - css

The following font declaration is not working in Internet Explorer 11.
font:300 28px/1.1em 'Lora', arial, sans-serif;
The text is displayed in arial instead of Lora. Lora is a Google Font.
It's working however in Mozilla Firefox, QupZilla and Google Chrome.
But when I change the declaration to
font:300 28px/1.1em 'Lora';
it's working in IE 11.
What could be the problem?
It gets even stranger: When I save the website as an *.html file to my local disc, the font is displayed correctly. :-(

Embed Google font on <head>.
<link href='http://fonts.googleapis.com/css?family=Lora' rel='stylesheet' type='text/css'>
and then try below css
.class{
font-family: 'Lora', Arial, sans-serif;
font-weight:400;
font-size:28px/1.1em;
}

Related

Roboto font in bold weight is invisible

I have a website for internal use that uses the Roboto google font. Here is the code that includes it.
<link href="//fonts.googleapis.com/css?family=Roboto:500" rel="stylesheet" type="text/css">.
&
body {
font-family: "Roboto";
}
b, strong {
font-weight: 700;
}
I've found someone at my company who's Chrome can't render this font when it is bold. I could replicate it by going to Youtube and making Roboto text bold with the inspect element. This problem does not occur on any other computers. The Chrome is up to date and has no extensions installed. I've tried closing and reopening Chrome as well as several hard refreshes. Forcing the browser to repaint with resize, CSS, or JS does not fix the issue either.
This does not dupe question Font Weight with Google Fonts Roboto, normal (400) and bold (700) work, light (300) does not. The problem occurs on both http and https versions of the site, the font is loaded with //, and I get no insecure content warnings from Chrome.
What is causing this, and is there anything I can do on the website or on the persons computer to further troubleshoot or fix this?
If you use Google Fonts
<link href="//fonts.googleapis.com/css?family=Roboto:500" rel="stylesheet" type="text/css">
without a fallback font like;
body {
font-family: "Roboto";
}
b, strong {
font-weight: 700;
}
You should provide that font-weight in your Google Fonts link like;
<link href="//fonts.googleapis.com/css?family=Roboto:500,700" rel="stylesheet" type="text/css">
Or, you should provide a fallback font;
body {
font-family: "Roboto", sans-serif;
}
By doing so, if your browser can't find the font-weight: 700; Roboto font, it can use a suitable sans-serif font from your system.
In ideal situations, using a font-family to support all possible computer systems like;
body {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
will solve all of these problems.

Font don't work on PC

I'm currently working on a store on Tictail (it's not uploaded yet, so I don't have a link). I want to use the font PT Sans Narrow for the store, but there is a problem:
The font displays correctly in Safari and Firefox on my iMac, but when my friend tries it in Firefox and Internet Explorer on his PC, the font doesn't display correctly.
This is what I'm working with:
<link href="{{assets_url}}/shared/css/base.css" rel="stylesheet" type="text/css">
body {
background-color: #fff;
font-family: 'PT Sans Narrow', sans-serif;
letter-spacing: -0.02em;
font-size: 14px;
line-height: 1.5em;
color: #222;
-webkit-font-smoothing:antialiased;
height: 100%;
}
What is the problem and how can it be solved?
It's because Windows don't have 'PT Sans Narrow' as default font. You need to add this font like a web-font. For instance from Google Fonts.
Simplest way:
<link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow' rel='stylesheet' type='text/css'>
Put this at the top of your base.css. It will import PT Sans Narrow from Google Fonts.
#import url(http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700);
A webpage will always check to see if the user has the font installed on their computer. If they don't it will import it from Google Fonts.

SVG Web Font Vertical Alignment in Google Chrome

As many of you will be aware when using windows + Chrome + Google fonts they can appear very distorted and choppy. I have implemented a fix which overrides the font with the SVG version of the font hosted on my site's server. So we have something like this:
<link href='http://fonts.googleapis.com/css?family=Oswald:400' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="style.css">
The style file containing:
#media screen and (-webkit-min-device-pixel-ratio:0) {
#font-face {
font-family: 'Oswald';
font-style: normal;
font-weight: 400;
src: url('fonts/oswald-regular-webfont.svg#oswaldregular') format('svg');
}
}
This works well for making the font appear smooth and clean like it should. However I have noticed a problem when it comes to the spacing around the font. If I add a background colour and padding to an element using the font, for example:
HTML:
<h1>Oswald Font Test</h1>
CSS:
h1 {
background: purple;
color: #fff;
font-family: 'Oswald';
font-style: normal;
font-weight: 400;
padding: 5px;
}
Then I find that the font in Chrome is not vertically central but instead closer to the top edge of the box. Whereas all the other browsers using the font-styles from Google are centrally aligned.
Question: Can anything be done to correct the alignment of my Google override?
I think the answer may lie in modifying the svg file's attributes, i.e:
<font-face units-per-em="2048" ascent="1638" descent="-410" />

Font Family Open Sans not being used

I am using Google's Open Sans Font in my application.
I have defined the stylesheet as instructed:
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,700'
rel='stylesheet' type='text/css'>
I then used it on the body selector as:
body {
font-family: 'Open Sans', sans-serif;
}
I have not defined font family anywhere else. I assume that since I have defined it at the parent, the child elements will automatically inherit it.
However, if I open up the inspector for say an anchor tag in my application and see the computed styles for that tag, I find that (Chrome Latest) the "Rendered Font" says "Times New Roman 18 glyphs" - Is this correct? I was expecting it to say "Open Sans" - Is the Open Sans font not being applied?
Check out the codepen link. Its working fine for me !
.open-sans-font{
font-family: 'Open Sans', sans-serif;
}
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet">
<div class="open-sans-font">
Stackoverflow rocks !!!
</div>

font-weight rendering differently on desktop browsers vs. iOS browsers

I'm using a Google Webfont called Open Sans with font-weight:800 specified for h1 tags. When I view this page on iOS browsers (Chrome and Safari on iPhone or iPad), the font renders more thinly than it renders in desktop browsers. You can see the difference in this screenshot.
I want the font-weight to render the same on all devices, can anyone help me?
My code:
h1 {
font-weight: 800;
font-family: 'OpenSans'
}
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400,600,800' rel='stylesheet' type='text/css'>
I believe you're missing a space here:
font-family: 'Open Sans'

Resources