简体   繁体   English

jQuery UI调整文本大小取决于父div和屏幕大小

[英]Jquery UI resize text size depends on parent div and screen size

I am using gridstack.js in one of my projects and there are 3 resizable and draggable divs on the grid. 我在一个项目中使用gridstack.js,并且网格上有3个可调整大小和可拖动的div。
I would like to resize text in p and h3 tags in these divs and save fontsize values when I resize parent div. 我想在这些div中调整p和h3标签中的文本大小,并在调整父div大小时保存fontsize值。 I can do this like this: Can text be resizable using jquery-ui? 我可以这样做: 可以使用jquery-ui调整文本大小吗?

But what should I do when the screen changes? 但是,当屏幕改变时我该怎么办? For example, I am using small screen and after I resize one of the divs, p fontsize may be 12px. 例如,我使用的是小屏幕,调整了div的大小后,p fontsize可能是12px。 When I use large screen what should be fontsize of p tag? 当我使用大屏幕时,p标签的fontsize应该是什么? How can I adjust this? 我该如何调整?

Thanks 谢谢

You could just use a @media rule to run each rule depending on the screen width. 您可以只使用@media规则来运行每个规则,具体取决于屏幕宽度。 http://www.w3schools.com/cssref/css3_pr_mediaquery.asp http://www.w3schools.com/cssref/css3_pr_mediaquery.asp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM