How to disable CSS Class on particular DIV
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
add a comment |
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
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
add a comment |
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
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
html css class styles
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
add a comment |
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
add a comment |
4 Answers
4
active
oldest
votes
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')
add a comment |
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>
add a comment |
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 ...
add a comment |
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");
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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')
add a comment |
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')
add a comment |
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')
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')
edited Sep 30 '14 at 12:51
answered Sep 16 '14 at 8:29
HerrSerker
19.8k84778
19.8k84778
add a comment |
add a comment |
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>
add a comment |
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>
add a comment |
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>
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>
answered Sep 16 '14 at 8:24
daker
1,98923044
1,98923044
add a comment |
add a comment |
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 ...
add a comment |
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 ...
add a comment |
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 ...
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 ...
answered Feb 21 '17 at 15:29
Cristian Florescu
34
34
add a comment |
add a comment |
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");
add a comment |
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");
add a comment |
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");
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");
answered Nov 19 at 23:07
Matthew Shaile
3519
3519
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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