Volkswagen Headline Font Treatment

Posted by admin

The Volkswagen Headline and the Volkswagen Copy are new versions of Futura (by Luc@MetaDesign, 1996). FontFabrik developed these into Multiple Master fonts. With two sets of figures, extra ligatures and arrows. Bigger view (33Kb, Flash plugin needed). How to Format a Press Release for the Associated Press. Businesses and organizations often promote news-worthy information via press releases sent to media outlets. These press releases can announce upcoming events, fundraisers, and other.

Active1 year, 4 months ago

I'm trying to make a font in a div responsive to the browser window. So far, it has worked perfectly, but the parent div has a max-width of 525px. Resizing the browser further will not make the font stop resizing. This has made me wonder if there is such a thing as min-font-size or max-font-size, and if such a thing does not exist, if there is a way to achieve something similar.

I thought that using percentages at font-size would work, but the bit of text won't scale accordingly to the parent div. Here's what I have:

The CSS for the parent div:

The CSS for the piece of text in question:

I have searched for quite a while on the internet, but to no avail.

Toby van KempenToby van Kempen
6721 gold badge8 silver badges15 bronze badges

9 Answers

No, there is no CSS property for minimum or maximum font size. Browsers often have a setting for minimum font size, but that’s under the control of the user, not an author.

You can use @media queries to make some CSS settings depending on things like screen or window width. In such settings, you can e.g. set the font size to a specific small value if the window is very narrow.

Jukka K. KorpelaJukka K. Korpela
159k27 gold badges205 silver badges308 bronze badges

You can do it by using a formula and including the viewport width.

This sets the minimum font size at 7px and amplifies it by .5vw depending on the viewport width.

Good luck!

AlmostPittAlmostPitt

It works well with CSS.

I went through the same issues and fixed it as follow.

Use a fixed 'px' size for maximum size at a specific width and above. Then for different smaller widths, use a relative 'vw' as a percentage of the screen.

The result below is that it adjusts itself at screens below 960px but keep a fixed size above. Just a reminder, not to forget to add in the html doc in header:

Example in CSS:

I hope it'll help!

Willy VAN INGENWilly VAN INGEN

I am coming a bit late here, I don't get that much credit for it, I am just doing a mix of the answers below because I was forced to do that for a project.

So to answer the question : There is no such thing as this CSS property. I don't know why, but I think it's because they are afraid of a misused of this property, but I don't find any use case where it can be a serious problem.

Whatever, what are the solutions ?

Two tools will allow us to do that : media queries ans vw property

1) There is a 'fool' solution consisting in making a media query for every step we eant in our css, changing font from a fixed amount to another fixed amount. It works, but it is very boring to do, and you don't have a smooth linear aspect.

Mr Headlines Font

2) As AlmostPitt explained, there is a brillant solution for the minima :

Minimum here would be 7px in addition to 0.5% of the view width. That is already really cool and working in most of cases. It does not require any media query, you just have to spend some time finding the right parameters.

As you noticed it is a linear function, basic maths learn you that two points already find you the parameters. Then just fix the font-size in px you want for very large screens and for mobile version, then calculate if you want to do a scientific method. Thought, it is absolutely not necessary and you can just go by trying.

3) Let's suppose you have a very boring client (like me) who absolutely wants a title to be one line and no more. If you used AlmostPitt solution, then you are in trouble because your font will keep growing, and if you have a fixed width container (like bootstrap stoping at 1140px or something in large windows).Here I suggest you to use also a media query. In fact you can just find the amout of px size maximum you can handle in your container before the aspect become unwanted (pxMax). This will be your maximum. Then you just have to find the exact screen width you must stop (wMax). (I let you inverse a linear function on your own).

After that just do

Then it is perfectly linear and your font-size stop growing ! Notice that you don't need to put your previous css property (calc..) in a media query under wMax because media query are considered as more imnportant and it will overwrite the previous property.

I don't think it is useful to make a snippet for this, as you would have trouble to make it to whole screen and it is not rocket science afterall.

Crack license dat matlab 7 10. Hope this could help others, and don't forget to thank AlmostPitt for his solution.

hol
7,1165 gold badges26 silver badges53 bronze badges
AlburkerkAlburkerk

Rucksack is brilliant, but you don't necessarily have to resort to build tools like Gulp or Grunt etc.

I made a demo using CSS Custom Properties (CSS Variables) to easily control the min and max font sizes.

Like so:

Dannie VintherDannie Vinther

I got some smooth results with these. It flows smoothly between the 3 width ranges, like a continuous piecewise function.

Chris TopillogicalChris Topillogical

You can use Sass to control min and max font sizes. Here is a brilliant solution by Eduardo Boucas.

matthewmatthew

This is actually being proposed in CSS4

Quote:

These two properties allow a website or user to require an element’s font size to be clamped within the range supplied with these two properties. If the computed value font-size is outside the bounds created by font-min-size and font-max-size, the use value of font-size is clamped to the values specified in these two properties.

This would actually work as following:

This would literally mean, the font size will be 5% of the viewport's width, but never smaller than 10 pixels, and never larger than 18 pixels.

Unfortunately, this feature isn't implemented anywhere yet, (not even on caniuse.com).

RoberrrtRoberrrt

Yes, there seems some restrictions by some browser in SVG.The developertool restrict it to 8000px;The following dynamically generated Chart fails for example in Chrome.

Try http://www.xn--dddelei-n2a.de/2018/test-von-svt/

PadinaPadina

Not the answer you're looking for? Browse other questions tagged htmlcssfontsfont-size or ask your own question.

Active2 months ago

I know that this could be solved fairly easily with Javascript, but I'm only interested in a pure CSS solution.

I want a way to dynamically resize text so that it always fits into a fixed div. Here is the sample markup:

I was thinking that maybe this could be possible by specifying the width of the container in ems, and getting the font-size to inherit that value?

captainsac
2,2122 gold badges17 silver badges38 bronze badges
DMTintnerDMTintner
9,8654 gold badges27 silver badges30 bronze badges

11 Answers

I just found out that this is possible using VW units. They're the units associated with setting the viewport width. There are some drawbacks, such as lack of legacy browser support, but this is definitely something to seriously consider using. Plus you can still provide fallbacks for older browsers like so:

http://css-tricks.com/viewport-sized-typography/and https://medium.com/design-ux/66bddb327bb1

DMTintnerDMTintner
9,8654 gold badges27 silver badges30 bronze badges

CSS3 supports new dimensions that are relative to view port. But this doesn't work in android < 4.4

  1. 3.2vw = 3.2% of width of viewport
  2. 3.2vh = 3.2% of height of viewport
  3. 3.2vmin = Smaller of 3.2vw or 3.2vh
  4. 3.2vmax = Bigger of 3.2vw or 3.2vh

see css-tricks.com/.. and also look at caniuse.com/..

or

Use media query.Simplest way is to use dimensions in % or em. Just change the base font size everything will change.

Use dimensions in % or em. Just change the base font size everything will change. In previous one you could just change the body font and not h1 every time or let base font size to default of the device and rest all in em

see kyleschaeffer.com/.. for more info on em, px and %

aWebDeveloperaWebDeveloper
20.7k29 gold badges124 silver badges204 bronze badges

You might be interested in the calc approach:

done. Tweak values till matches your taste.

Source: https://codepen.io/CrocoDillon/pen/fBJxu

RexfordRexford
4,0214 gold badges43 silver badges87 bronze badges

I know I'm ressurecting a long dead question, but I had the same question and I wanted to add something. Please don't ban me for this, I felt it was important enough to justify this answer, I'll delete if required. @Joseph Silber is wrong, coding all the possibilities actually is a viable way to do this. The reason is because there actually aren't infinite possibilities. Well, technically there are, but 99% of your visitors will be using a standard resolution. This is doubly true for mobile (the main reason for responsive web design) because most mobile OSes run apps full screen with no window resizing.

Also, height is pretty much irrelevant because of the scrollbar (to a point, I would immediately leave a web page that was more than 4 or 5 feet long, but this mostly holds true), so you only need to worry about width. And really, the only widths you need to code for are the following: 240, 320, 480 (for older iThings), 640, 800, 1024, 1280, 1440, 1600, 1920, 2048, 2560. Don't even bother for 4k, it will bloat your images too much and the 2560 size stretched to 100% width looks just fine on a 4k monitor (I've tested this). Also, don't bother with 720 (720x480) as the previous poster suggested. Its a resolution used almost exclusively by digital cameras, and even then its very uncommon.

If someone is using an exotic resolution, nearly any renderer made in the past 15 years will round down, so if someone's screen width is, say. 1100, its going to load the 1024 CSS rule, your site shouldn't break. This renders accounting for exotic resolutions by trying to create a responsive rule unnecessary, and the idea that you need to code for every possible setup pixel by pixel is ridiculous, unless someone's using a web browser so outdated that your site probably wouldn't load at all anyway.

user281058user281058

The only way would probably be to set different widths for different screen sizes, but this approach is pretty inacurate and you should use a js solution.

Sven RojekCo headline fontSven Rojek
3,6562 gold badges25 silver badges49 bronze badges

For reference, here's a JS solution that re-sizes a font depending on the text length within a container.

Codepen with slightly modified code, but same idea as below:

Newspaper Headline Font

For me, I call this function when a user makes a selection in a drop-down, and then a div in my menu gets populated (this is where I have dynamic text occurring).

In addition, I also use CSS ellipses ('..') to truncate yet even longer text too, like so:

So, ultimately:

  • Short text: e.g. 'APPLES'

    Fully rendered, nice big letters.

  • Long text: e.g. 'APPLES & ORANGES'

    Gets scaled down 70%, via the above JS scaling function.

  • Super long text: e.g. 'APPLES & ORANGES & BANAN..'

    Gets scaled down 70% AND gets truncated with a '..' ellipses, via the above JS scaling function together with the CSS rule.

You could also explore playing with CSS letter-spacing to shrink text down while keeping the same font size.

MarsAndBackMarsAndBack
2,9803 gold badges15 silver badges33 bronze badges

As many mentioned in comments to @DMTinter's post, the OP was asking about the number ('amount') of characters changing. He was also asking about CSS, but as @Alexander indicated, 'it is not possible with only CSS'. As far as I can tell, that seems to be true at this time, so it also seems logical that people would want to know the next best thing.

I'm not particularly proud of this, but it does work. Seems like an excessive amount of code to accomplish it. This is the core:

Here's a JS Bin: http://jsbin.com/pidavon/edit?html,css,js,console,output
Please suggest possible improvements to it (I'm not really interested in using canvas to measure the text..seems like too much overhead(?)).

Thanks to @Pete for measureText function:https://stackoverflow.com/a/4032497/442665

jbobbinsjbobbins

This solution might also help :

It worked for me well !

Gaurav KrishnGaurav Krishn
Headline news font

Free Headline Fonts

Try RFS (for responsive font size) library by MartijnCuppens that maybe will be implemented in Bootstrap

Fred KFred K
8,4217 gold badges57 silver badges82 bronze badges

use this equation.

For anything larger or smaller than 1440 and 768, you can either give it a static value, or apply the same approach.

The drawback with vw solution is that you cannot set a scale ratio, say a 5vw at screen resolution 1440 may ended up being 60px font-size, your idea font size, but when you shrink the window width down to 768, it may ended up being 12px, not the minimal you want. With this approach, you can set your upper boundary and lower boundary, and the font will scale itself in between.

ShuweiShuwei

Create a lookup table that computes font-size based on the length of the string inside your <div>.

Adjust and tune all parameters by empirical test.

MowzerMowzer
6,0018 gold badges51 silver badges120 bronze badges

Not the answer you're looking for? Browse other questions tagged csscss3 or ask your own question.