Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the solution to not displaying text when the font-size value in textarea under IE is very large?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Today, I will talk to you about the solution to the text not displayed when the font-size value in IE is very large. Many people may not understand it. In order to let you know more, Xiaobian summarizes the following contents for you. I hope you can gain something according to this article.

In IE, we write a textarea of fixed height and width, and give a select to select the font size and act on the textarea.

In non-IE browsers, the original font size of textarea is 18px. When the font-size of the text in this textarea is changed to 108, it looks like this:

But in IE, it really looks like this:

Looking for a solution online, but it seems that few people encounter this situation, so a combination of css to try, and finally found a solution, but the cause of this situation is still unknown.

Solution:

In IE, after changing font-size to 108px, set the width of textarea to 0, and then set it back to the original width.

I guess the reason is that in the original width, the font becomes very large, IE browser has a bug in the calculation of the width occupied by the font.

However, after setting the width to 0 and then to the original width, IE will recalculate the width of the font once, and this is normal.

The javascript code is as follows:

The code is as follows:

var width = $("textarea").css("width");

$("#txt-area").css("width", "0%");

setTimeout(function () {

$("#txt-area").css("width",width);

}, 20);

If we don't delay 20 seconds to return to the original altitude, it will fail in some cases, and the specific reasons are still to be verified.

After reading the above content, do you have any further understanding of the solution to not displaying text when font-size value is very large in textarea under IE? If you still want to know more knowledge or related content, please pay attention to the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report