Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8304079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:43:39+00:00 2026-06-08T17:43:39+00:00

I have some document in a div that is being displayed, and I want

  • 0

I have some document in a div that is being displayed, and I want the user to be able to adjust the font size of what is inside it. Some sort of code like this:

$("#fontPlusBtn").click(function (){
    $("#textDiv").css("font-size", "*=1.1");
}):

How can I resize all the text nodes (which vary in size) proportionally in this div?

Update: (Working version)

I combined a few answers here plus altered what I had earlier, so for anyone else stumbling upon this problem later on, here’s what I did:

var upFontSize = function($obj) {
    $obj.children().each(function(index){
        if($(this).children().length > 0){
            upFontSize($(this));
        }else {
            $(this).css({
                "font-size": function(index, value) {
                    return parseFloat(value) * 1.1;
                },
            });
        }
    });
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:43:41+00:00Added an answer on June 8, 2026 at 5:43 pm

    This is answers your question and accounts for the multiple text sizes, and sizing them accordingly:

    …And here is a working example:

    http://jsfiddle.net/Xr2gj/44/

    js:

    $(document).ready(function (){
        $("#fontPlusBtn").click(function (){
            $(".textDiv, .textDiv > *").each( function(index){
                $(this).css( {
                    "font-size": function(index, value) {
                        return parseFloat(value) * 1.1;
                  }
                });
            });
        });
    });
    

    css:

    #world{
        font-size: 8pt;
    }
    
    #solarSystem{
        font-size: 12pt;
    }
    #galaxy{
        font-size: 14pt;
    }
    
    #universe{
        font-size: 16pt;
    }
    

    html:

    <a id="fontPlusBtn" href="#">
        Click to increase font-size
    </a>
    
    <div class="textDiv" id="world">
        Hello World!
    </div>
    
    <div class="textDiv" id="solarSystem">
        <p><b>Hello Solar System!</b></p>
    </div>
    
    <div class="textDiv" id="galaxy">
        <p>Hello Galaxy!</p>
    </div>
    
    <div class="textDiv" id="universe">
        <p><div><b><a href="#">Hello Universe!</a></b></div></p>
    </div>
    

    ​You may be able to mix with some of the other answers, but this http://jsfiddle.net/Xr2gj/44/ shows it working just as you specified.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function that requires some vars being appended to a div. One
I have some code which I want to document with in-body comments like so:
I have some jQuery code that intercepts links clicked on a page: $(document).ready(function() {
I have written some code that loads an XML document using an XmlDocument object
I have a list of data or quotes that are being displayed, I only
I have some input checkboxes that are being dynamically generated in a $.post callback
I have some code like this: var mySelect = document.getElementById(mySelect); mySelect.innerHTML = <option>Loading...</option>; $.get(ajaxPage.php,
I have some code like this: var content = document.getElementById('myDivId'); function MyFunction() { alert(content.style.height);
I have a document type of info I also have some custom properites. infoTitle
i have some problems with rowspan: var doc1 = new Document(); doc1.SetPageSize(PageSize.A4.Rotate()); string path

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.