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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:45:27+00:00 2026-06-09T02:45:27+00:00

For one project, I’ve to use a defined stylesheet. I cannot edit it, I’ve

  • 0

For one project, I’ve to use a defined stylesheet. I cannot edit it, I’ve to take it as it comes.

But, there is some styles which aren’t adequate for this website(e.g. margin).

I’ve too create my own CSS file which override some of those properties.

One example, if I’ve this:

<div id="main-content" class="container">My test text</div>

And the following css instruction in a css file:

div.container{margin:5px}
div#main-content{margin-left:235px; ...}

I would like in MY css to define that the div#main-content hasn’t this margin but it’s default value.

How could I do it? I don’t want to do a margin-left:0px because if I’ve a global style(saying that all div.container should have a 5px margin, I would like it applies to my previous div. And thoses data could change.

  • 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-09T02:45:29+00:00Added an answer on June 9, 2026 at 2:45 am

    There’s no pure-CSS way to remove a property value declaration without explicitly setting it to another value.

    So if you have a situation like this:

     <div id="divA" class="class3 class1"></div>
     <div id="divB" class="class3 class2"></div>
    
     .class1{margin:2px;}
     .class2{margin:3px;}
     .class3{margin:10px;}
    

    …and you want to cancel the effects of class3 so that divA has margin of 2px, and divB has margin of 5px, your only pure-CSS recourses will involve explicitly referencing each case. I.E. in your overriding stylesheet, you would have to re-assert:

     .class1{margin:2px;}
     .class2{margin:3px;}
    

    …and so on for however many classes/selector contexts may be affected. This is probably unrealistic.

    If you’re willing to dive into JavaScript, you can actually remove the class-name from the element.

    For straight-up JavaScript example of how to do that, see: Remove CSS class from element with JavaScript (no jQuery)

    If you want simpler code, and are willing to take on a JavaScript library, jQuery will let you do this in one line like this:

    $('divA').removeClass('class3');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making one project in which use of map-view is required. I have
So I have one model called Project, for which there is a nested model
I am coding one project, which needs to launch some webbrowsers with the given
i need to have one project on asp.net mvc 1 but i want to
I am working on one project where there is a functionality need to implement
I have one project which has RIAService with entity framework that is referenced to
I am working on one project. In which i want to find out Is
I have made one project which is showing the inventory of the stock of
I have one project using storyboard. I have one UIView and I put some
i have one project working greate but in other iphone not working .both are

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.