2

is there a way to have text resize as the browser gets smaller for liquid based design in percentages.

images divs etc, all rescale but text percentage scaling its not possible! setting it in percentages just changes the unified em setting for that text - in every browser width identicaly.

webestdesigns
  • 438
  • 1
  • 4
  • 15

3 Answers3

7

Other than using media queries at specific intervals, I'm not really sure.

The way I would do it:

.content {
    font-size:16px;
}

@media all and (max-width: 800px) {
    .content {font-size:14px;}
}

@media all and (max-width: 600px) {
    .content {font-size:12px;}
}

@media all and (max-width: 400px) {
    .content {font-size:10px;}
}

No javascript, pure CSS.

dvlden
  • 2,402
  • 8
  • 38
  • 61
tinyBIGideas
  • 194
  • 4
  • 13
  • If you've replaced what's inside the media queries with your own code then it should work. What happens, nothing? – tinyBIGideas May 06 '11 at 18:22
  • thanks, However I want all the em width and height of the divs etc, to resize as well! – webestdesigns May 15 '11 at 11:11
  • works with ems! but have to write @media screen and (min-width: 85em) and (max-width: 100em) { body { font-size:.8em;} } @media screen and (min-width: 100em) and (max-width: 110em) { body { font-size:.9em;} } – webestdesigns Jun 18 '11 at 17:57
2

I believe this is exactly what you were looking for:

http://css-tricks.com/viewport-sized-typography/

Alex Mund
  • 431
  • 3
  • 9
0

Yes, it is possible to resize text by handling the onResize event with JavaScript code. There are quite a few issues with onResize, though, including debouncing, which can get complicated.

I know this isn't part of your question, but I wonder if it's a good idea to resize text. After all, the user has already told the browser s/he's happy with the text at its current size. Is it really all that friendly to override the user's manifest preference?

Community
  • 1
  • 1
Pete Wilson
  • 8,610
  • 6
  • 39
  • 51
  • just so that when the browser is very small it should be possible to retain the basic layout have a look [link](http://www.davidrothassociates.co.uk) – webestdesigns May 06 '11 at 12:04