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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:06:58+00:00 2026-05-25T03:06:58+00:00

How can I determine the element is using css height or css max-height ?

  • 0

How can I determine the element is using css height or css max-height?

for instance, I have these two elements,

<div style="height:100px">fixed</div>
<div style="max-height:100px">max-height</div>

I want to change their height/ max-height to 100% when a button is clicked.

$('div').height('100%').height();

This will only change the first element not the second one.

I was thinking to use if condition to check:

if( use height ) $('div').height('100%').height();
else  $('div').css({maxHeight:'100%'}).height();

But I don’t know how to check… any ideas? or you may have a better idea than mine?

  • 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-25T03:06:59+00:00Added an answer on May 25, 2026 at 3:06 am

    You can use something like the below code to set both of them at once.

    $('#div').css({height: "100%", maxHeight:"100%"});
    

    Hope this is useful!!

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

Sidebar

Related Questions

How can I use jQuery to determine whether an element has a certain style
How can I determine using jQuery that a given element is above the top
How can I determine if my displays are in Clone Mode without using either
How can I determine if I have write permission on a remote machine in
How can I determine the explicit width of a HTML element that has width
Hod do you determine the new index of an element sorted using jQuery UI
I'm using Backbone.js have a segmented control-type UI element for each model's view. They
I have the following two errors when using XMLReader. 1) Warning: XMLReader::read() [xmlreader.read]: MyXML.xml:43102:
I'm using jQuery to loop through some elements in a document. These elements are
Code to determine the lat element of a list, using pattern matching: @tailrec def

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.