相对于用户屏幕分辨率的字体大小? [英] Font size relative to the user's screen resolution?
问题描述
我有一个流畅的网站,菜单是其宽度的20%。我想要正确测量菜单的字体大小,因此它总是适合框的宽度,不会换行到下一行。
我正在考虑使用em作为一个单位,但它是相对于浏览器的字体大小,所以当我更改分辨率时,字体大小保持不变。
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.
推荐答案
@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.
这篇关于相对于用户屏幕分辨率的字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!