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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:56:28+00:00 2026-06-14T18:56:28+00:00

Possible Duplicate: how to remove css property using javascript? I have this javascript: var

  • 0

Possible Duplicate:
how to remove css property using javascript?

I have this javascript:

var div = document.getElementById('myDiv');
div.style.width = '300px';
div.style.height = '200px';
...

and so on…

Later on I am faced with the need of removing a property
(not changing its value, really removing meaning: like I had not set that before)

I coded something like this:

  1. div.style.height = undefined;
  2. div.style.height = null;
  3. div.style.height = ”;

Only solution n.3 seems to work but even so… I am not sure this is the correct way to do it (I am only using chrome to test this)

Does anybody know what’s the correct way ? which works across all proper browsers ?

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-14T18:56:29+00:00Added an answer on June 14, 2026 at 6:56 pm

    There’s no “correct way”. Microsoft once invented style.removeAttribute(), but it’s not supported. The best way is to set it to the standard-value.

    Edit: As dystroy mentioned, setting it to “” resets it in all browsers, so that would be the best way.

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

Sidebar

Related Questions

Possible Duplicate: Remove CSS from a Div using JQuery we can set backgroung-image property
Possible Duplicate: How to remove a cookie by using Javascript? javascript:void(document.cookie=PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602:LM=1257919388:S=odm0Ys-53ZueXfZG;path=/; domain=.google.com); How to
Possible Duplicate: How to remove all CSS classes using jQuery? I have the following:
Possible Duplicate: php multi-dimensional array remove duplicate I have an array like this: $a
Possible Duplicate: Remove white space below image I have this page HERE . All
Possible Duplicate: jQuery - remove style added with .css() function I want to remove
Possible Duplicate: dynamically add/remove style in javascript It's required to write javascript functions to
Possible Duplicate: How to change/remove CSS classes definitions at runtime? I have a HTML
Possible Duplicate: remove duplicate from string in PHP Have a string like: $str =
Possible Duplicate: php regexp: remove all attributes from an html tag $input = '<div

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.