Removing right-padding from Ext.JS buttons
I have some buttons declared using Ext.NET. They have the following class:
.btn-summary {
padding-top: 0px;
padding-bottom: 0px;
padding-right: 0px;
}
I set the text property on the buttons using the setText function:
myBtn.setText("Some text<div class="summary " + myCls + "">" + "Some other text"</div>");
There are two classes that apply to the text here: summary and myCls where summary is:
div.summary {
margin-top: 0px;
margin-bottom: 0px;
margin-right: 0px;
margin-left: 7px;
padding: 7px;
display: inline-block;
}
and myCls can be either of two classes, defined programmatically:
.bad {
background-color: #FF4630;
border-bottom-color: #FF4630;
border-top-color: #FF4630;
font-weight: bold;
color: white;
text-align: center;
}
.good {
background-color: #00FFB3;
border-color: #00FFB3;
font-weight: bold;
text-align: center;
}
I have observed that everything in this setup works as expected (buttons render where they're supposed to, the highlighted portion goes out to the borders of the button as it's supposed to) except that there's about a two/three-pixel padding outside the boundaries of the div but inside the button which I can't account for. Examination of the HTML reveals the following:
<a class="x-btn btn-summary x-unselectable x-box-item x-toolbar-item x-btn-default-toolbar-small" hidefocus="on" unselectable="on" role="button" aria-hidden="false" aria-disabled="false" tabindex="0" style="right: auto; left: 85px; margin: 0px; top: 0px;">
<span id="btnWrap" data-ref="btnWrap" role="presentation" unselectable="on" style="" class="x-btn-wrap x-btn-wrap-default-toolbar-small ">
<span id="FaultedDashboardsSummary-btnEl" data-ref="btnEl" role="presentation" unselectable="on" style="" class="x-btn-button x-btn-button-default-toolbar-small x-btn-button-center x-btn-text">
<span id="btnInnerEl" data-ref="btnInnerEl" unselectable="on" class="x-btn-inner x-btn-inner-default-toolbar-small">
Some text
<div class="summary good">
Some other text
</div>
</span>
</span>
</span>
</a>
The issue appears to be the .x-btn-inner-default-toolbar-small class. The problem here is that I can't change this from the Ext.NET side because I only have access down to the top level (the one defined by the a tag) so how can I add a CSS class to the inner-most span from Ext.JS?
javascript css extjs
add a comment |
I have some buttons declared using Ext.NET. They have the following class:
.btn-summary {
padding-top: 0px;
padding-bottom: 0px;
padding-right: 0px;
}
I set the text property on the buttons using the setText function:
myBtn.setText("Some text<div class="summary " + myCls + "">" + "Some other text"</div>");
There are two classes that apply to the text here: summary and myCls where summary is:
div.summary {
margin-top: 0px;
margin-bottom: 0px;
margin-right: 0px;
margin-left: 7px;
padding: 7px;
display: inline-block;
}
and myCls can be either of two classes, defined programmatically:
.bad {
background-color: #FF4630;
border-bottom-color: #FF4630;
border-top-color: #FF4630;
font-weight: bold;
color: white;
text-align: center;
}
.good {
background-color: #00FFB3;
border-color: #00FFB3;
font-weight: bold;
text-align: center;
}
I have observed that everything in this setup works as expected (buttons render where they're supposed to, the highlighted portion goes out to the borders of the button as it's supposed to) except that there's about a two/three-pixel padding outside the boundaries of the div but inside the button which I can't account for. Examination of the HTML reveals the following:
<a class="x-btn btn-summary x-unselectable x-box-item x-toolbar-item x-btn-default-toolbar-small" hidefocus="on" unselectable="on" role="button" aria-hidden="false" aria-disabled="false" tabindex="0" style="right: auto; left: 85px; margin: 0px; top: 0px;">
<span id="btnWrap" data-ref="btnWrap" role="presentation" unselectable="on" style="" class="x-btn-wrap x-btn-wrap-default-toolbar-small ">
<span id="FaultedDashboardsSummary-btnEl" data-ref="btnEl" role="presentation" unselectable="on" style="" class="x-btn-button x-btn-button-default-toolbar-small x-btn-button-center x-btn-text">
<span id="btnInnerEl" data-ref="btnInnerEl" unselectable="on" class="x-btn-inner x-btn-inner-default-toolbar-small">
Some text
<div class="summary good">
Some other text
</div>
</span>
</span>
</span>
</a>
The issue appears to be the .x-btn-inner-default-toolbar-small class. The problem here is that I can't change this from the Ext.NET side because I only have access down to the top level (the one defined by the a tag) so how can I add a CSS class to the inner-most span from Ext.JS?
javascript css extjs
add a comment |
I have some buttons declared using Ext.NET. They have the following class:
.btn-summary {
padding-top: 0px;
padding-bottom: 0px;
padding-right: 0px;
}
I set the text property on the buttons using the setText function:
myBtn.setText("Some text<div class="summary " + myCls + "">" + "Some other text"</div>");
There are two classes that apply to the text here: summary and myCls where summary is:
div.summary {
margin-top: 0px;
margin-bottom: 0px;
margin-right: 0px;
margin-left: 7px;
padding: 7px;
display: inline-block;
}
and myCls can be either of two classes, defined programmatically:
.bad {
background-color: #FF4630;
border-bottom-color: #FF4630;
border-top-color: #FF4630;
font-weight: bold;
color: white;
text-align: center;
}
.good {
background-color: #00FFB3;
border-color: #00FFB3;
font-weight: bold;
text-align: center;
}
I have observed that everything in this setup works as expected (buttons render where they're supposed to, the highlighted portion goes out to the borders of the button as it's supposed to) except that there's about a two/three-pixel padding outside the boundaries of the div but inside the button which I can't account for. Examination of the HTML reveals the following:
<a class="x-btn btn-summary x-unselectable x-box-item x-toolbar-item x-btn-default-toolbar-small" hidefocus="on" unselectable="on" role="button" aria-hidden="false" aria-disabled="false" tabindex="0" style="right: auto; left: 85px; margin: 0px; top: 0px;">
<span id="btnWrap" data-ref="btnWrap" role="presentation" unselectable="on" style="" class="x-btn-wrap x-btn-wrap-default-toolbar-small ">
<span id="FaultedDashboardsSummary-btnEl" data-ref="btnEl" role="presentation" unselectable="on" style="" class="x-btn-button x-btn-button-default-toolbar-small x-btn-button-center x-btn-text">
<span id="btnInnerEl" data-ref="btnInnerEl" unselectable="on" class="x-btn-inner x-btn-inner-default-toolbar-small">
Some text
<div class="summary good">
Some other text
</div>
</span>
</span>
</span>
</a>
The issue appears to be the .x-btn-inner-default-toolbar-small class. The problem here is that I can't change this from the Ext.NET side because I only have access down to the top level (the one defined by the a tag) so how can I add a CSS class to the inner-most span from Ext.JS?
javascript css extjs
I have some buttons declared using Ext.NET. They have the following class:
.btn-summary {
padding-top: 0px;
padding-bottom: 0px;
padding-right: 0px;
}
I set the text property on the buttons using the setText function:
myBtn.setText("Some text<div class="summary " + myCls + "">" + "Some other text"</div>");
There are two classes that apply to the text here: summary and myCls where summary is:
div.summary {
margin-top: 0px;
margin-bottom: 0px;
margin-right: 0px;
margin-left: 7px;
padding: 7px;
display: inline-block;
}
and myCls can be either of two classes, defined programmatically:
.bad {
background-color: #FF4630;
border-bottom-color: #FF4630;
border-top-color: #FF4630;
font-weight: bold;
color: white;
text-align: center;
}
.good {
background-color: #00FFB3;
border-color: #00FFB3;
font-weight: bold;
text-align: center;
}
I have observed that everything in this setup works as expected (buttons render where they're supposed to, the highlighted portion goes out to the borders of the button as it's supposed to) except that there's about a two/three-pixel padding outside the boundaries of the div but inside the button which I can't account for. Examination of the HTML reveals the following:
<a class="x-btn btn-summary x-unselectable x-box-item x-toolbar-item x-btn-default-toolbar-small" hidefocus="on" unselectable="on" role="button" aria-hidden="false" aria-disabled="false" tabindex="0" style="right: auto; left: 85px; margin: 0px; top: 0px;">
<span id="btnWrap" data-ref="btnWrap" role="presentation" unselectable="on" style="" class="x-btn-wrap x-btn-wrap-default-toolbar-small ">
<span id="FaultedDashboardsSummary-btnEl" data-ref="btnEl" role="presentation" unselectable="on" style="" class="x-btn-button x-btn-button-default-toolbar-small x-btn-button-center x-btn-text">
<span id="btnInnerEl" data-ref="btnInnerEl" unselectable="on" class="x-btn-inner x-btn-inner-default-toolbar-small">
Some text
<div class="summary good">
Some other text
</div>
</span>
</span>
</span>
</a>
The issue appears to be the .x-btn-inner-default-toolbar-small class. The problem here is that I can't change this from the Ext.NET side because I only have access down to the top level (the one defined by the a tag) so how can I add a CSS class to the inner-most span from Ext.JS?
javascript css extjs
javascript css extjs
edited Nov 12 at 20:57
asked Nov 12 at 20:15
Woody1193
2,246930
2,246930
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Can't say anything without seeing a visualisation but I would recommend checking CSS !important
.btn-summary {
padding-right: 0 !important;
}
What does !important mean in CSS?
Also, you can try adding box-sizing to your elements
.btn-summary {
box-sizing: border-box;
}
https://www.w3schools.com/cssref/css3_pr_box-sizing.asp
1
I updated my question. Your answer would work if not for the sillyness that is Ext.JS
– Woody1193
Nov 12 at 20:58
add a comment |
Given the inner class .x-btn-inner-default-toolbar-small was causing the padding issue, adding this CSS rule fixed the problem:
.btn-summary .x-btn-inner-default-toolbar-small {
padding-right: inherit;
}
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%2f53269443%2fremoving-right-padding-from-ext-js-buttons%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Can't say anything without seeing a visualisation but I would recommend checking CSS !important
.btn-summary {
padding-right: 0 !important;
}
What does !important mean in CSS?
Also, you can try adding box-sizing to your elements
.btn-summary {
box-sizing: border-box;
}
https://www.w3schools.com/cssref/css3_pr_box-sizing.asp
1
I updated my question. Your answer would work if not for the sillyness that is Ext.JS
– Woody1193
Nov 12 at 20:58
add a comment |
Can't say anything without seeing a visualisation but I would recommend checking CSS !important
.btn-summary {
padding-right: 0 !important;
}
What does !important mean in CSS?
Also, you can try adding box-sizing to your elements
.btn-summary {
box-sizing: border-box;
}
https://www.w3schools.com/cssref/css3_pr_box-sizing.asp
1
I updated my question. Your answer would work if not for the sillyness that is Ext.JS
– Woody1193
Nov 12 at 20:58
add a comment |
Can't say anything without seeing a visualisation but I would recommend checking CSS !important
.btn-summary {
padding-right: 0 !important;
}
What does !important mean in CSS?
Also, you can try adding box-sizing to your elements
.btn-summary {
box-sizing: border-box;
}
https://www.w3schools.com/cssref/css3_pr_box-sizing.asp
Can't say anything without seeing a visualisation but I would recommend checking CSS !important
.btn-summary {
padding-right: 0 !important;
}
What does !important mean in CSS?
Also, you can try adding box-sizing to your elements
.btn-summary {
box-sizing: border-box;
}
https://www.w3schools.com/cssref/css3_pr_box-sizing.asp
edited Nov 12 at 20:36
answered Nov 12 at 20:30
Ihsan S
324
324
1
I updated my question. Your answer would work if not for the sillyness that is Ext.JS
– Woody1193
Nov 12 at 20:58
add a comment |
1
I updated my question. Your answer would work if not for the sillyness that is Ext.JS
– Woody1193
Nov 12 at 20:58
1
1
I updated my question. Your answer would work if not for the sillyness that is Ext.JS
– Woody1193
Nov 12 at 20:58
I updated my question. Your answer would work if not for the sillyness that is Ext.JS
– Woody1193
Nov 12 at 20:58
add a comment |
Given the inner class .x-btn-inner-default-toolbar-small was causing the padding issue, adding this CSS rule fixed the problem:
.btn-summary .x-btn-inner-default-toolbar-small {
padding-right: inherit;
}
add a comment |
Given the inner class .x-btn-inner-default-toolbar-small was causing the padding issue, adding this CSS rule fixed the problem:
.btn-summary .x-btn-inner-default-toolbar-small {
padding-right: inherit;
}
add a comment |
Given the inner class .x-btn-inner-default-toolbar-small was causing the padding issue, adding this CSS rule fixed the problem:
.btn-summary .x-btn-inner-default-toolbar-small {
padding-right: inherit;
}
Given the inner class .x-btn-inner-default-toolbar-small was causing the padding issue, adding this CSS rule fixed the problem:
.btn-summary .x-btn-inner-default-toolbar-small {
padding-right: inherit;
}
answered Nov 13 at 22:16
Woody1193
2,246930
2,246930
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%2f53269443%2fremoving-right-padding-from-ext-js-buttons%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