JQuery UI Button - text below a custom icon

I am trying to create a jQuery user interface button with a user icon at the top of the text. The default behavior creates an icon to the left / right of the text, but I want the icon to be on top! It can be done? If so, your help / guidance is appreciated.

In addition, how can I create a custom 32x32 icon (even increasing the height of the button did not help and deprived the icon). Thanks in advance.

HTML:

<button id="btnSave">Save</button>

JS:

$('#btnSave').button({
    icons: {primary: "saveIcon"}
});

CSS

.saveIcon {
    background-image: url(../images/Save.png) !important;
}
+3
source share
1 answer

Try this CSS bit ( demo ):

.ui-button-icon-primary.ui-icon.saveIcon {
    height: 32px;
    width: 32px;
    margin: 10px 0 2em -16px; 
    text-align: center;
    left: 50%;
    top: 5px;
    background-image: url(../images/Save.png) !important;
}
.ui-button-text-icon-primary .ui-button-text {
    display: block;
    position: static;
    padding: 50px 10px 5px 10px;
}
+3
source

Source: https://habr.com/ru/post/1768523/


All Articles