Reputation: 43
I am trying to create a jQuery UI button with a custom icon on the top of the text. The default behavior creates icon on the left/right of the text but I want the icon to be on the top! Can this be done? If so, your help/guidance is greatly appreciated.
Also, how can one have a 32x32 size Custom Icon (even increasing the height of the button didn't help and was stripping 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;
}
Upvotes: 4
Views: 5039
Reputation: 86413
Try this bit of CSS (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;
}
Upvotes: 3