Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you size the jQuery Button?

I'm using the jQuery UI Button control but don't seem to be able to adjust the size (width and height). Here's the API documentation. I tried setting a STYLE attribute on it, but then the LABEL wasn't centered correctly. Thanks.

like image 587
Alex Avatar asked Apr 27 '10 18:04

Alex


People also ask

How do I set button size?

Editing the size of a button in HTML is relatively easy. In the simplest form you just have to add a 'style' attribute to the button element containing your desired height and width values in pixels. It goes something like this. Alternatively, you can add a 'class' to button and add your styles in a CSS file.

How do I change the size of a button box in HTML?

HTML, CSS and JavaScript To set the button width, use the CSS width property.

How do I make a button smaller in HTML?

button-small , and your HTML attribute class="button button-small" . .


2 Answers

Try this in the style attribute:

width: 300px; padding-top: 10px; padding-bottom: 10px; 

or

$(element).css({ width: '300px', 'padding-top': '10px', 'padding-bottom': '10px' }); 
like image 114
Jakob Kruse Avatar answered Oct 06 '22 01:10

Jakob Kruse


normally:

$(theElement).css('height','...px').css('width','...px'); 
like image 27
joanballester Avatar answered Oct 05 '22 23:10

joanballester