Home > database >  How to set the width:fit-content property in javascript
How to set the width:fit-content property in javascript

Time:03-21

I'm a beginner in javascript, how can I set an element (div) with id="container? My option is like this, but it doesn't work.

$('#container').style.height = fit_content

You can use jquery, or you can without it

CodePudding user response:

With jQuery:

$('#container').css('height', 'fit-content');

Without:

document.getElementById('container').style.height = 'fit-content';
  • Related