System.drawing.font:想要在em中使用font-size的最终CSS,但它总是在px中 [英] System.drawing.font : want final CSS for font-size in em but it is always in px

查看:156
本文介绍了System.drawing.font:想要在em中使用font-size的最终CSS,但它总是在px中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用System.Drawing.Font将css应用于某些html元素。我看到结果css的字体大小总是在px中,例如font-size:16px; 。我想要em中的font-size,例如font-size:1em; 。



我之所以想要css是因为只有在这种情况下,浏览器设置中字体大小的变化才会反映在任何网页中。



请让我知道需要更改什么才能获得字体大小的CSS。



我尝试了什么:



我尝试使用不同的GraphicsUnit选项,如点,像素等,但css始终保持为px

I'm using System.Drawing.Font to apply css to some html elements. I see that the resultant css has font-size always in px for eg font-size: 16px; . I want the font-size in em for eg font-size: 1em; .

The reason why I want the css in em is because only in this case , change in font-size in browser settings will reflect in any web-page.

Please let me know what needs to be changed to get the font-size css in em.

What I have tried:

I've tried using different GraphicsUnit options like point,pixel etc but the css always remains as px

推荐答案

在px中设置正文字体大小,并在整个文档中设置为1em。然后,您可以在 em 中的css的其余部分中设置字体大小。
Set your body font size in px, and that's 1em throughout the document. You can then make your font sizes in the rest of your css in em.


这篇关于System.drawing.font:想要在em中使用font-size的最终CSS,但它总是在px中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆