Angular Material elements/fonts are too big for desktop use

梦想的初衷 提交于 2020-05-29 05:22:52

问题


I have a website that is using Angular material. I like elements and everything except default font sizes and elements are huge. To see website in acceptable scale me or my users have to zoom out at least 75% on the desktop and majority of my users are desktop users. Is there a way to specify in angular material to use smaller fonts, elements, etc?


回答1:


in your main css file

add following

html {
    font-size: 62.5% // adjust the size with percentage here.
}

and i recommend using em and rem for font-sizing

let me know if it didn't worked, i might provide another solution




回答2:


Before you attempt anything, make sure you are using the correct fonts and font sizes by following the typography guide.

Font sizes can be adjusted by customizing the typography. Changing the size of elements is technically possible, but to do it you would need to override the styles for every Angular Material component - so it is highly impractical.

Also, component sizes as well as font sizes are determined by the Material Design specifications, so changing things means you are no longer properly following the specification, and IMO you would end up with a bad looking web site (at least bad looking in terms of following Material Design).



来源:https://stackoverflow.com/questions/50378844/angular-material-elements-fonts-are-too-big-for-desktop-use

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!