How to disable CSS Class on particular DIV












-3














I want to disable class automatically applied on div.



<div class="A B">


I want to disable Class 'A' but not 'B'. How could I do that ?










share|improve this question




















  • 15




    Open a text editor. Place the cursor after the letter A. Press backspace. Save the file.
    – Quentin
    Sep 16 '14 at 8:20










  • Could you be more clearly? Do you want some CSS that disables the class, or some JavaScript?
    – HerrSerker
    Sep 16 '14 at 8:26






  • 1




    Add this as a jQuery function somewhere. $('.A').removeClass('B');
    – timo
    Sep 16 '14 at 8:27










  • You can't stop an element form being a member of a class using CSS. There is no such thing an an inherited class.
    – Quentin
    Sep 16 '14 at 8:34






  • 1




    no javascript, jquery allowed : jQuery is javascript
    – fcalderan
    Sep 16 '14 at 8:37
















-3














I want to disable class automatically applied on div.



<div class="A B">


I want to disable Class 'A' but not 'B'. How could I do that ?










share|improve this question




















  • 15




    Open a text editor. Place the cursor after the letter A. Press backspace. Save the file.
    – Quentin
    Sep 16 '14 at 8:20










  • Could you be more clearly? Do you want some CSS that disables the class, or some JavaScript?
    – HerrSerker
    Sep 16 '14 at 8:26






  • 1




    Add this as a jQuery function somewhere. $('.A').removeClass('B');
    – timo
    Sep 16 '14 at 8:27










  • You can't stop an element form being a member of a class using CSS. There is no such thing an an inherited class.
    – Quentin
    Sep 16 '14 at 8:34






  • 1




    no javascript, jquery allowed : jQuery is javascript
    – fcalderan
    Sep 16 '14 at 8:37














-3












-3








-3


1





I want to disable class automatically applied on div.



<div class="A B">


I want to disable Class 'A' but not 'B'. How could I do that ?










share|improve this question















I want to disable class automatically applied on div.



<div class="A B">


I want to disable Class 'A' but not 'B'. How could I do that ?







html css class styles






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 3 '16 at 13:51









Quinn Wilson

5,48211729




5,48211729










asked Sep 16 '14 at 8:19









Devendra

2761423




2761423








  • 15




    Open a text editor. Place the cursor after the letter A. Press backspace. Save the file.
    – Quentin
    Sep 16 '14 at 8:20










  • Could you be more clearly? Do you want some CSS that disables the class, or some JavaScript?
    – HerrSerker
    Sep 16 '14 at 8:26






  • 1




    Add this as a jQuery function somewhere. $('.A').removeClass('B');
    – timo
    Sep 16 '14 at 8:27










  • You can't stop an element form being a member of a class using CSS. There is no such thing an an inherited class.
    – Quentin
    Sep 16 '14 at 8:34






  • 1




    no javascript, jquery allowed : jQuery is javascript
    – fcalderan
    Sep 16 '14 at 8:37














  • 15




    Open a text editor. Place the cursor after the letter A. Press backspace. Save the file.
    – Quentin
    Sep 16 '14 at 8:20










  • Could you be more clearly? Do you want some CSS that disables the class, or some JavaScript?
    – HerrSerker
    Sep 16 '14 at 8:26






  • 1




    Add this as a jQuery function somewhere. $('.A').removeClass('B');
    – timo
    Sep 16 '14 at 8:27










  • You can't stop an element form being a member of a class using CSS. There is no such thing an an inherited class.
    – Quentin
    Sep 16 '14 at 8:34






  • 1




    no javascript, jquery allowed : jQuery is javascript
    – fcalderan
    Sep 16 '14 at 8:37








15




15




Open a text editor. Place the cursor after the letter A. Press backspace. Save the file.
– Quentin
Sep 16 '14 at 8:20




Open a text editor. Place the cursor after the letter A. Press backspace. Save the file.
– Quentin
Sep 16 '14 at 8:20












Could you be more clearly? Do you want some CSS that disables the class, or some JavaScript?
– HerrSerker
Sep 16 '14 at 8:26




Could you be more clearly? Do you want some CSS that disables the class, or some JavaScript?
– HerrSerker
Sep 16 '14 at 8:26




1




1




Add this as a jQuery function somewhere. $('.A').removeClass('B');
– timo
Sep 16 '14 at 8:27




Add this as a jQuery function somewhere. $('.A').removeClass('B');
– timo
Sep 16 '14 at 8:27












You can't stop an element form being a member of a class using CSS. There is no such thing an an inherited class.
– Quentin
Sep 16 '14 at 8:34




You can't stop an element form being a member of a class using CSS. There is no such thing an an inherited class.
– Quentin
Sep 16 '14 at 8:34




1




1




no javascript, jquery allowed : jQuery is javascript
– fcalderan
Sep 16 '14 at 8:37




no javascript, jquery allowed : jQuery is javascript
– fcalderan
Sep 16 '14 at 8:37












4 Answers
4






active

oldest

votes


















7














I think you are looking for CSS that says. Don't listen to class A.



Alas, there is no such CSS.




  • Either you have to remove the class A from your source code.

  • Or you remove the class from the DOM by means of JavaScript.

  • Or you must overwrite your CSS in class B that any value that was set in class A gets initial/neutral values (sometimes it's the value 'initial', sometimes its the value 'auto' or 'none')






share|improve this answer































    2














    You are probably looking for a javascript...



    Add a id to your div and use



    <div id="whatever" class="A B"></div>

    <script type="text/javascript">
    window.document.onload = function(){
    document.getElementById("whatever").className = "A";
    }
    </script>





    share|improve this answer





























      0














      I think that I accomplished succesefully. :)



      For example I have my html code :



      <a class="m2" href="#">Some text here, with bold</a>
      <a class="m2 nobold" href="#">Some text here, without bold</a>


      I use CSS for the first text



      .m2 {
      font-weight: bold;
      }


      And for disable it, I use



      .nobold {
      font-weight: normal;
      }


      And it apply both, but you can change settings from the other CSS class ...






      share|improve this answer





























        0














        If you want to do this in straight js, give the div an ID:



        <div id="myDiv" class="A B"></div>


        And then in js:



        document.getElementById("myDiv").classList.remove("B");





        share|improve this answer





















          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f25863836%2fhow-to-disable-css-class-on-particular-div%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          4 Answers
          4






          active

          oldest

          votes








          4 Answers
          4






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          7














          I think you are looking for CSS that says. Don't listen to class A.



          Alas, there is no such CSS.




          • Either you have to remove the class A from your source code.

          • Or you remove the class from the DOM by means of JavaScript.

          • Or you must overwrite your CSS in class B that any value that was set in class A gets initial/neutral values (sometimes it's the value 'initial', sometimes its the value 'auto' or 'none')






          share|improve this answer




























            7














            I think you are looking for CSS that says. Don't listen to class A.



            Alas, there is no such CSS.




            • Either you have to remove the class A from your source code.

            • Or you remove the class from the DOM by means of JavaScript.

            • Or you must overwrite your CSS in class B that any value that was set in class A gets initial/neutral values (sometimes it's the value 'initial', sometimes its the value 'auto' or 'none')






            share|improve this answer


























              7












              7








              7






              I think you are looking for CSS that says. Don't listen to class A.



              Alas, there is no such CSS.




              • Either you have to remove the class A from your source code.

              • Or you remove the class from the DOM by means of JavaScript.

              • Or you must overwrite your CSS in class B that any value that was set in class A gets initial/neutral values (sometimes it's the value 'initial', sometimes its the value 'auto' or 'none')






              share|improve this answer














              I think you are looking for CSS that says. Don't listen to class A.



              Alas, there is no such CSS.




              • Either you have to remove the class A from your source code.

              • Or you remove the class from the DOM by means of JavaScript.

              • Or you must overwrite your CSS in class B that any value that was set in class A gets initial/neutral values (sometimes it's the value 'initial', sometimes its the value 'auto' or 'none')







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Sep 30 '14 at 12:51

























              answered Sep 16 '14 at 8:29









              HerrSerker

              19.8k84778




              19.8k84778

























                  2














                  You are probably looking for a javascript...



                  Add a id to your div and use



                  <div id="whatever" class="A B"></div>

                  <script type="text/javascript">
                  window.document.onload = function(){
                  document.getElementById("whatever").className = "A";
                  }
                  </script>





                  share|improve this answer


























                    2














                    You are probably looking for a javascript...



                    Add a id to your div and use



                    <div id="whatever" class="A B"></div>

                    <script type="text/javascript">
                    window.document.onload = function(){
                    document.getElementById("whatever").className = "A";
                    }
                    </script>





                    share|improve this answer
























                      2












                      2








                      2






                      You are probably looking for a javascript...



                      Add a id to your div and use



                      <div id="whatever" class="A B"></div>

                      <script type="text/javascript">
                      window.document.onload = function(){
                      document.getElementById("whatever").className = "A";
                      }
                      </script>





                      share|improve this answer












                      You are probably looking for a javascript...



                      Add a id to your div and use



                      <div id="whatever" class="A B"></div>

                      <script type="text/javascript">
                      window.document.onload = function(){
                      document.getElementById("whatever").className = "A";
                      }
                      </script>






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Sep 16 '14 at 8:24









                      daker

                      1,98923044




                      1,98923044























                          0














                          I think that I accomplished succesefully. :)



                          For example I have my html code :



                          <a class="m2" href="#">Some text here, with bold</a>
                          <a class="m2 nobold" href="#">Some text here, without bold</a>


                          I use CSS for the first text



                          .m2 {
                          font-weight: bold;
                          }


                          And for disable it, I use



                          .nobold {
                          font-weight: normal;
                          }


                          And it apply both, but you can change settings from the other CSS class ...






                          share|improve this answer


























                            0














                            I think that I accomplished succesefully. :)



                            For example I have my html code :



                            <a class="m2" href="#">Some text here, with bold</a>
                            <a class="m2 nobold" href="#">Some text here, without bold</a>


                            I use CSS for the first text



                            .m2 {
                            font-weight: bold;
                            }


                            And for disable it, I use



                            .nobold {
                            font-weight: normal;
                            }


                            And it apply both, but you can change settings from the other CSS class ...






                            share|improve this answer
























                              0












                              0








                              0






                              I think that I accomplished succesefully. :)



                              For example I have my html code :



                              <a class="m2" href="#">Some text here, with bold</a>
                              <a class="m2 nobold" href="#">Some text here, without bold</a>


                              I use CSS for the first text



                              .m2 {
                              font-weight: bold;
                              }


                              And for disable it, I use



                              .nobold {
                              font-weight: normal;
                              }


                              And it apply both, but you can change settings from the other CSS class ...






                              share|improve this answer












                              I think that I accomplished succesefully. :)



                              For example I have my html code :



                              <a class="m2" href="#">Some text here, with bold</a>
                              <a class="m2 nobold" href="#">Some text here, without bold</a>


                              I use CSS for the first text



                              .m2 {
                              font-weight: bold;
                              }


                              And for disable it, I use



                              .nobold {
                              font-weight: normal;
                              }


                              And it apply both, but you can change settings from the other CSS class ...







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Feb 21 '17 at 15:29









                              Cristian Florescu

                              34




                              34























                                  0














                                  If you want to do this in straight js, give the div an ID:



                                  <div id="myDiv" class="A B"></div>


                                  And then in js:



                                  document.getElementById("myDiv").classList.remove("B");





                                  share|improve this answer


























                                    0














                                    If you want to do this in straight js, give the div an ID:



                                    <div id="myDiv" class="A B"></div>


                                    And then in js:



                                    document.getElementById("myDiv").classList.remove("B");





                                    share|improve this answer
























                                      0












                                      0








                                      0






                                      If you want to do this in straight js, give the div an ID:



                                      <div id="myDiv" class="A B"></div>


                                      And then in js:



                                      document.getElementById("myDiv").classList.remove("B");





                                      share|improve this answer












                                      If you want to do this in straight js, give the div an ID:



                                      <div id="myDiv" class="A B"></div>


                                      And then in js:



                                      document.getElementById("myDiv").classList.remove("B");






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Nov 19 at 23:07









                                      Matthew Shaile

                                      3519




                                      3519






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Stack Overflow!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.





                                          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                          Please pay close attention to the following guidance:


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f25863836%2fhow-to-disable-css-class-on-particular-div%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                                          Alcedinidae

                                          Origin of the phrase “under your belt”?