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 7636147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:35:58+00:00 2026-05-31T07:35:58+00:00

I have a floated div, and a user can change the font size. When

  • 0

I have a floated div, and a user can change the font size. When they do, I have this code:

$(element).css ( 'font-size', newFontSize); 
alert ( $(element).css ( 'height' ) ); //60px
$(element).css ( 'width', 'auto' );
$(element).css ( 'height', 'auto' );
alert ( $(element).height()); //60 - no resize

The idea is that by resetting the div to auto height, it should resize to fit the text, but it’s not doing so. Ideas?

  • 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-05-31T07:35:59+00:00Added an answer on May 31, 2026 at 7:35 am

    maybe your code doesn’t work because you also set a min-height somewhere along with the height

    as alternative idea you could set the height in em (or other relative measurements), so when you change the font-size the height will change automatically (without set its height to auto)

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

Sidebar

Related Questions

I have the following code: http://jsfiddle.net/3fT2M/ Why isn't the two floated div background color
Suppose I have this HTML structure: <div class=a> <div class=floated-left>...</div> <div class=floated-left>...</div> </div> I
The problem i am facing with floated div is i have written this piece
How to vertically align the text in a floated div? For example: I have
I have a html like this: The idea is that divs are floated left
I have a div that contains a paragraph, a list and a right-floated div.
The following markup is not something I can change as it's based on user
I have a mobile web gallery page where I have a CSS floated next
I have a div that contains many floated child items. Each child item is
I have 1 span within a container div. I want the span floated to

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.