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

  • SEARCH
  • Home
  • 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 9005933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:16:39+00:00 2026-06-16T01:16:39+00:00

EDIT : For anyone who cares, the problem was so simple that I overlooked

  • 0

EDIT : For anyone who cares, the problem was so simple that I overlooked it, since I was using a table if the column on the right was the column with the extra content it would try to change the one on the left as it would still have a greater height, although reducing the text size would not actually fix it thus causing the loop I was getting, the solution was to use independent divs instead! Hope this helps someone!

I’m having a slight issue with some jQuery that I’m trying to write. What I want to do is go through every div with the same class, if that div is has a height greater then 25px then to decrease the font size by 1px until it fits on to one line.

The code I have works for the first one, but doesn’t run on the other divs, any help would be great!

Regards,

Shikoki

$(document).ready(function() {
        $('.lmmteam').each(function() {
            $('.lmmteam').css('font-size', '30px');
                while( $('.lmmteam').height() > 25 ) 
                    {
                        $('.lmmteam').css('font-size', (parseInt($('.lmmteam').css('font-size')) - 1) + "px" );
                    }
            });
    });

Just thought I should add the html markup as well to make it easier here you go!

<table>
  <tr>
    <td class="randomclass"></td>
    <td class="lmmteam">Long text</td>
    <td class="randomclass"></td>
    <td class="randomclass"></td>
    <td class="lmmteam">Long text</td>
    <td class="randomclass"></td>
  </tr>
  <tr>
    <td class="randomclass"></td>
    <td class="lmmteam">Long text</td>
    <td class="randomclass"></td>
    <td class="randomclass"></td>
    <td class="lmmteam">Long text</td>
    <td class="randomclass"></td>
  </tr>

And there are several rows but the format remains the same. Thanks!

  • 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-16T01:16:41+00:00Added an answer on June 16, 2026 at 1:16 am

    Try

    $(document).ready(function() {
        $('.lmmteam').each(function() {
            $(this).css('font-size', '30px');
            while ($(this).height() > 25) {
                $(this).css('font-size', (parseInt($(this).css('font-size'),10) - 1) + "px");
            }
        });
    });​
    

    jsFiddle example

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

Sidebar

Related Questions

EDIT : For anyone who might come across this post with a similar problem,
Just a little edit, in case it helps anyone out who happens to stumble
is there anyone who have experienced problems using the latests jQuery version with one
EDIT: Looking for help from J. Leffler, Cheese Con Queso or anyone who knows
This should be a very simple question for anyone who has some experience in
I'm using a Keyboard hook in my XNA project (anyone who uses XNA knows
This question is for anyone that's had personal experience. The question is simple: Does
Anyone who know a alternative to this? http://razorjack.net/quicksand/ Maybe something that would actually sort
I have a shared spreadsheet that can be edited by anyone who's got the
edit: in case anyone is wondering, the actionhandler invokes code that creates and disposes

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.