barakuda28 barakuda28 - 2 months ago 9
CSS Question

Font size relative to the user's screen resolution?

I have a fluid website and the menu is 20% of its width. I want the font size of the menu to be measured properly so it always fits the width of the box and never wrap to the next line.
I was thinking of using "em" as a unit but it is relative to the browser's font size, so when I change resolutions the font size stays the same.

Tried also pts and percentages. Nothing works as I need it...

Give me a hint of how to proceed, please.

Answer
@media screen and (max-device-width : 320px)
{
  body or yourdiv element
  {
    font:<size>px/em/cm;
  }
}
@media screen and (max-device-width : 1204px)
{
  body or yourdiv element
  {
    font:<size>px/em/cm;
  }
}

You can give it manually according to screen size of screen.Just have a look of different screen size and add manually the font size.

Comments