For my application I need narrow table rows (size="small" isn't small enough). With antd 4.x this was done by using css which was applied to the table cells.
const App: React.FC = () => (
<Table
className="narrow"
columns={columns}
dataSource={data}
onRow={(data) => ({
style: { fontStyle: "italic", background: "gold" }
})}
/>
);
and the css looks like
div.narrow tbody td {
padding-right: 2px;
padding-left: 2px;
padding-top: 2px;
padding-bottom: 2px;
}
Codesandbox with antd 4.x
Result with antd 4.x
When using antd 5.x the css is no longer effect. I reckon they changed something regarding the css. But I don't know what to do to get the same result. Can anybody give me hint?
Codesandbox with antd 5.x
result with andt 5.x
Related
I have mat-grid-list where I am listing items in the view.
issue 1:
Each item has a mat-grid-tile-footer section where I display a angular material button. The button is currently aligned left side in the footer section and I want to align the button in the centre of mat-grid-tile-footer using below code ( flex row centre is also not working inside footer) but it's not working. Any ideas ?
issue 2:
On applying [style.background]="'white'" to the footer the mat-raised-button text also gets invisible. Seems like it is overriding the button behaviour too. Any ideas ?
<mat-grid-tile-footer [style.background]="'white'">
<div fxLayout="row" fxLayoutAlign="center center">
<button mat-raised-button>Try me</button>
</div>
</mat-grid-tile-footer>
TRY 1
On using margin: auto I see the changed styles is not picked up and below is the used styles
.mat-grid-tile .mat-grid-tile-header>*, .mat-grid-tile .mat-grid-tile-footer>* {
margin: 0;
padding: 0;
font-weight: normal;
font-size: inherit;
}
Issue 1: adding CSS .mat-grid-tile-footer div{ margin: auto; } resolves it
Issue 2: unable to observe the behavior of the text getting invisible
working stackblitz here
update: in light of comment below...
remove margin: 0 from the class in your question... so that the CSS is only:
.mat-grid-tile-footer div{ margin: auto; }
.mat-grid-tile .mat-grid-tile-header>*, .mat-grid-tile .mat-grid-tile-footer>* {
padding: 0;
font-weight: normal;
font-size: inherit;
}
I can't find a way to do this
There seems to be padding placed above and below the element, although I have set it zero
https://plnkr.co/edit/WvEqNCxEcLY5yS1IT738?p=preview
<div>
<button>hello</button>
</div>
<table><tr><td>
<button>hiya</button>
</td></tr></table>
td,
div{
padding: 0;
height: 10em;
border: solid;
}
button {
height: 100%;
width:100%;
border:solid 10px #f00;
}
I don't want to use absolute position as the contents vary, and JS would be an overhead I couldn't live with!
Is there a known bug here? Would anyone have a link to it so I can watch it not get fixed for years and drives me to a stress related end
Thanks in advance
ios pic
chrome on win 10 (desired result)
Thebutton, input, textarea, img, video, audio etc. are REPLACED ELEMENTS. The positioning rules for them are other than for standard elements. You can try to enclose replaced elements into a span or div.
Add <div/> inside <td/> and put <button/> into <div/> it will work properly. Add styles to new <div/> element and use:
button
{
height: 100%;
width:100%;
padding:0;
margin:0;
}
<table><tr><td><div class="replaced-element-container"><button>hiya</button></div></td></tr></table>
Well, this is embarrassing but it meets W3C requirements.
For one table cell in the row:
td, div
{
padding: 0;
height: 10em;
border: solid;
display:block;
}
button
{
height: 100%;
width:100%;
border:solid 10px #f00;
}
But it doesn't resolve problem that button is replaced element. It is still in container made from <td/> element.
I use a kendo grid in my application with custom command for each line like this:
.Columns(
columns =>
{
//fields 1
//fields 2
columns.Command(command =>
{
command.Custom("View").Click("view");
command.Custom("Edit").Click("edit");
command.Custom("Delete").Click("delete");
}).Width(300);
}
)
It work but now I need to put icon (awesome font ?) instead of string.
Thank you for help
You can customize the look and like of the buttons with CSS. In the following example the button is customized with a background-image.
.k-grid-content .k-button {
width: 20px;
height: 20px;
border: none;
min-width: 0 !important;
border-radius: 0;
color: transparent;
text-indent: -10000%;
box-shadow: none !important;
}
.k-grid-content .k-button span {
display: none;
}
.k-grid-content .k-button.k-grid-Edit {
background: url(/img/icons/icon-edit.png) no-repeat;
}
I created a dojo for you. Hope it helps.
http://dojo.telerik.com/ETIYa/2
Simply put the question is - is there a way to align link text within an action link vertically?
I need to make a button-looking Html.ActionLink control.
There is a reasonably good example at Html.ActionLink as a button or an image, not a link
I have implemented this approach, however, I need not just an "image" button,
but an image button with a text shown on it, and this text depends on view model's state, so that I cannot simply put it on an image.
Here is what I have (Razor):
#Html.ActionLink(#commitee.Name, "CommiteePage", "SecureFolder",
new { commiteeName = commitee.Name, page = 1 },
new { #class = "commiteeButton" })
and CSS:
a.commiteeButton {
background: transparent url("../Images/BlueButton.png") no-repeat top left;
display: block;
width: 304px;
height: 50px;
color: white;
text-decoration: none;
font: normal 14px Arial;
text-align: center;
margin-bottom: 10px;
}
The result is OK, but: the text of a link is located on the top of an image, and not in its middle (vertically).
I do not know how to center link text vertically, so that it can be located right in the center of an image.
Of course, there can be another approach (see below) but maybe it is still possible with approach mentioned above?
<a class="nonunderlinedlink" href="#Url.Action("CommiteePage", "SecureFolder", new { commiteeName=commitee.Name, page = 1 }, null)">
<div class="commiteeButton">
<p class="pstyle">#commitee.Name</p>
</div>
</a>
Try the following changes in your css
a.commiteeButton {
background: transparent url("../Images/BlueButton.png") no-repeat top left;
display: block;
width: 304px;
height: 50px;
color: white;
text-decoration: none;
font: normal 14px Arial;
text-align: center;
margin-bottom: 10px;
display: table-cell;
vertical-align: middle;
}
Rex (see comments to my question above) suggested putting padding-top to CSS, that has resolved issue without causing collateral layout problems.
Thank you all for your quick reply!
I know it's a bit late but you could also use line-height: 50px; to center your text vertically
I am rendering a jQuery combobox, but the height of input element does not match the height of toggle button as shown in screen shot below. This is happening in both, IE 9 and FireFox 13.
The style being used for jQuery combobox is as below.
<style>
.ui-combobox {
position: relative;
display: inline-block;
}
.ui-combobox-toggle {
position: absolute;
top: 0;
bottom: 0;
margin-left: -1px;
padding: 0;
/* adjust styles for IE 6/7 */
*height: 1.7em;
*top: 0.1em;
}
.ui-combobox-input {
margin: 0;
padding: 0.3em;
}
.ui-autocomplete { height: 200px; overflow-y: auto; }
</style>
You should update your combo-box widget from the jqueryui page. and make sure that you use the latest jquery-ui (this issue was fixed recently).
this helped me...