Home  >  Q&A  >  body text

javascript - How to make all font sizes in a container increase by size 4 with jquery?

The font size of the content edited by the user through the background in the web page is too small. I want to make it larger dynamically through js. The problem is that the content and labels edited by the user in the container cannot be determined. Do I want to make the content in the container larger? Is it convenient to set the size of labels one by one? Is there any good way to increase text size?

某草草某草草2685 days ago954

reply all(6)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-18 10:52:48

    In addition to the traversal method,
    You can set all child elements to inherit...

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-18 10:52:48

    var inc = 4;
    var fs = parseInt($(ele).css("fontSize"));//获取元素font-size 转化为数字;
    $(ele).css("fontSize", fs + inc);//设置字体大小
    //或
    $(ele).css("fontSize", fs + inc + "px");

    ele sets the outer container.

    reply
    0
  • PHP中文网

    PHP中文网2017-05-18 10:52:48

    Should we use em units? It stands to reason that just changing it to one fontSize will be enough.

    reply
    0
  • 某草草

    某草草2017-05-18 10:52:48

    It can be done with css; for example:
    .article p { font-size:15px !important; }
    !important This is very important, because this weight is the highest level in css. Hope it helps you

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-18 10:52:48

    This cannot be adjusted, and you can’t adjust it either. They changed the font size on that day if you don’t guarantee it. . .

    reply
    0
  • 为情所困

    为情所困2017-05-18 10:52:48

    Generally, for content edited with the background editor, adjustments should be made by re-editing the text size in the background, and should not require adjustments on the front end.

    reply
    0
  • Cancelreply