I want to make text super thin, less than
font-weight: 100
Is that possible to do with CSS?
Like this but with helvetica:
CSS font weights do not "make fonts thin" (or bold) when dealing with web fonts. For not-loaded-from-url fonts the font-weight value maps from ultra thin to extra bold, but for custom fonts the weight is "whatever the #font-face binding says it should be": they are merely differentiation numbers used when declaring a font family with multiple weights.
The following is a CSS declaration for a web font that uses three weights, but have a close look at font resource vs. font weight:
#font-face {
font-family: "Helvetica Neue";
font-weight: 800;
src: url(helveticaneue-ultrathin.woff);
}
#font-face {
font-family: "Helvetica Neue";
font-weight: 400;
src: url(helveticaneue-regular.woff);
}
#font-face {
font-family: "Helvetica Neue";
font-weight: 100;
src: url(helveticaneue-ultrathin.woff);
}
This gives us one CSS-declared font family, with three defined weights (using value other than 100, 400, or 800, will lead to undefined behaviour). Now two of those weights point to the same font resource.
The following code will style text using the ultra-thin font, even though the CSS uses weight 800, which for predefined fonts normally means "pretty damn bold":
<p style="font-family: 'Helvetica Neue'; font-weight:800">This is thin!</p>
So if you want to use a superduper thin font: go for it. But that has nothing to do with the CSS font-weight value, and everything to do with the value you assign it in its #font-face rule, and then use in your font-using-CSS.
The weight of the font displayed must be available in the font you have chosen. If the font weight does not exist in that set then you cannot select it with CSS. That is why you need to look at what weights are available in the font you choose. Such things are listed, for example, in Google Fonts but font companies usually list what weights are available, whether they are free or purchased.
For example, Open Sans lists its lightest weight as 300. If you set it to 100, you won't see anything different than if you set it to 300 cause 100 does not exist.
Despite all that, you say you want to set the weight to something less than 100. However, less than 100 is not part of the CSS standard so, no, you cannot do that.
You can find the font here..: https://www.facebook.com/RITCreative/app/208195102528120/
Instead of hoping for an impossible font-weight to magically become real, use Font Forge to make your own font.
What you probably want is Helvetica Nue which is installed on Macs.
Anyways look at Google fonts and use the Filters: Thickness like what Rob suggested.
Use:
font-weight:"lighter"
And you'll get a similar result.
Related
For example I want to use Monsterrat font-family. I import it to my css file like this:
#import url('https://fonts.googleapis.com/css?family=Montserrat:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i');
Then I can use it like this:
font-family: 'Montserrat', sans-serif;
The url above has font-weight and italic modifiers and have their own names like, "Light Italic", "Italic Medium" etc...
My problem with that, I can simply adjust font weight: 300, and font-style: italic without the url. I want to use the name "Italic Medium" INLINE, like the this.
font-family: 'Montserrat', Light Italic;
Is it possible to do?
Yes and no,
Your example is:
font-family: 'Montserrat', Light Italic;
The Google font weight 'light' is weight 300 (for italic or normal font-style). And also in CSS font-weight: normal is equivelent to font-weight: 400, and bold is equivelent to 700.
So that allows us to get close using the font shorthand syntax which allows a number of font properties such as the font-style, font-weight and font-family you want to be declared in one go.
Unfortunately, the font-size value is a requirement of the font shorthand syntax so you'll need that in there too:
font: italic normal 1rem 'monserrat'
or
font: italic 300 1rem 'monserrat'
The second one there gets you the equivalent of the 'Light' font-weight but 'Light' isn't a valid CSS font-weight - 'normal' and 'bold' are along with a few relative terms as well such as 'lighter' or 'bolder'.
You could also use initial or inherit as possible values for the font-size.
You can use that style inline.
<p style="font: italic 300 1rem 'monserrat'">...</p>
Not quite what you were after? But as close as you will get :)
More about font shorthand:
https://css-tricks.com/snippets/css/font-shorthand/
https://www.impressivewebs.com/css-font-shorthand-property-cheat-sheet/
And an additional point - each of the styles you include in your import rule add to the load time and bulk of your page, it's probably a good idea to identify which you will use and only include those. For example, if you don't need a 700 weight italic font, don't include the 700i in your import
[Before we start] I'm a Chinese user, and there are so many different weights of Chinese font. They are in the same font-family, but they didn't stay together like latin fonts, e.g., Huakang Chaohei(~Black) and Huakang Cuhei(~Bold).For that, I have to choose different font-family, rather than font-weight.
So this question happens so frequently to me when choosing different font-weight and font-family.
Just like the following picture, can I use font-family: "helvetica bold" in CSS? Or, use font-family: helvetica; font-weight: 600 to specify the bolder version of helvetica?
UPDATE:
Thanks all. So how to do with the name different than bold?
You would use the latter, like this:
font-family: helvetica;
font-weight: bold;
or you can use this:
font-weight: bold;
Note, you likely should include more fonts, as not all browsers will render helvetica, so you could use something like this:
font-family: Helvetica,Arial,sans-serif;
Edit to match the above edit:
he values you can use are normal (which is the default weight), bold, bolder, lighter. You can also use the values from 100 to 900, the higher being bolder. You can also use initial and inherit.
Note font-weight should work fine with Chinese; the fonts themselves are the ones you need to pay attention to.
I can't seem to find a font weight lower than 300 using Open Sans anywhere. In photoshop I can get the desired look from selecting 'Light'. Helvetica Neue's 100 weight is what I'm looking for. Is there a way I can make it myself?
https://www.google.com/fonts/specimen/Open+Sans
There is no font weight typeface of Open Sans lighter than 300. Since Open Sans is under Apache License, you may create derivative works, such as typeface similar to Open Sans Light but lighter. Creating a typeface, with a font editor, is nontrivial, especially if the result should look good.
What you see in Photoshop is generally different from what you see in a browser, and different browsers render fonts differently, too.
The lightest weight of Open Sans is 'Light', which is the 300 weight. You should be able to use it by including this stylesheet from Google Fonts:
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
Be sure to set the correct font-weight in your CSS where you intend to use Open Sans. Example:
h1 {
font-weight: 300;
font-family: 'Open Sans', sans-serif;
}
The Open Sans Light (300) appears to be "lighter" in weight than Helvetica Neue Light when comparing same Cap heights Specimens with the Specimen [link] you provided.
If you want to get something "lighter" than 300, try converting the text to outlines and increase the outline stroke (in the bg colour) to cover the flabby part. The shortcut will come back and haunt you since the text becomes artwork and can't be edited without redoing the text. I wouldn't suggest this for more than a word or two.
Is it still reasonable to assume that font-weight:normal and font-weight:400 are equivalent even when using Web Fonts?
In the value of font-weight, normal by definition means 400. This does not depend on font.
Using #font-face, it is possible to cheat e.g. by declaring a font face as having normal weight (by defaulting font-weight, or by setting it to normal or 400) even though the typeface is in fact bold (or light or whatever). Fontsquirrel #font-face generator does this: it effectively defines each typeface as a font family. Example:
/* Generated by Font Squirrel (http://www.fontsquirrel.com) on January 22, 2013 */
#font-face {
font-family: 'source_sans_probold';
src: url('sourcesanspro-bold-webfont.eot');
src: url('sourcesanspro-bold-webfont.eot?#iefix') format('embedded-opentype'),
url('sourcesanspro-bold-webfont.woff') format('woff'),
url('sourcesanspro-bold-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
This means that an element may have the font-weight value of 400, even though the typeface actually used is bold design.
This is not in any way related to the use of 400 vs. normal, and it’s not just the font weight. FontSquirrel plays the same game with font-style.
This may not be the definitive answer but it will have to do for now - I went through the whole current set of 617 fonts on Google Web Fonts. From what I can see Normal is always 400. All current fonts specifiy Normal, 400.
The one thing I should add - there are some WOFF fonts, e.g. Open Sans Condensed, which do not in fact have a "Normal" style at all. However, this should not break the assumption of Normal = 400.
Here is an interesting gotcha with Chrome. It silently replaces font-weight:700 with font-weight:bold. It doesn't try to do that with the other font weights. Even so if you are relying on numeric values it is best to put in a silent test that does the requisite replacements. Something along the lines of
var sample = $('#fontSampleA');
var fontwt = sample.css('font-weight');
fontwt = ('normal' == fontwt)?400:(('bold' == fontwt)?700:(('book' == fontwt)?300:fontwt));
just in case a future version starts trying to do more silent "smart conversions".
I am new to Google Fonts. I have gotten this URL from Google:
<link href='http://fonts.googleapis.com/css?family=Ubuntu:400,400italic,700,700italic' rel='stylesheet' type='text/css'>
My question is, how to use the various fonts I have selected. They are, as you can see, Ubuntu Normal 400, Ubuntu Normal 400 Italic, Ubuntu Bold 700, and Ubuntu 700 italic.
I have tried everything but can only use plain "Ubuntu" and nothing else.
Please help!
Here is me using italic version of this: http://jsfiddle.net/6wzuy/
font-family:ubuntu;
font-style:italic;
font-weight: 700;
The technique is to use CSS font-style Property
font-family: 'Ubuntu', Arial, serif; font-weight: 700;
EDIT: You have to include separate font libraries of italics and bolds in order for them to work as intended.
If you don't include the italic and bold versions, the browser will try to compensate, but will more than likely do a very poor job. More about this in this List Apart article.
If you want to add font styles to your fonts, always add the extra font styles to and specify it in your document. Especially in large serif font it can make a huge difference.
The Google code you use declares regular, italic, bold, and bold italic typeface (specific font) as members of the font (font family) “Ubuntu”. This implies that you use italic and bolding just as you do when using normal fonts.
You can use font-style: italic to request for italic typeface and font-weight: bold (or, equivalently, font-weight: 700) to request bolding. Note that many HTML elements imply italic or bold by default; for example, h1, strong, and th elements imply font-weight: bold.
There are other ways of using #font-face so that each typeface is declared as a font family of its own; FotSquirrel does that. But the approach applied by Google is more logical and compatible with the way fonts are generally used in HTML and in CSS.