button width css code example
Example 1: button size html
<button style="height:40px; width:40px;">Press Me</button>
Example 2: button css
<a href="#" class="myButton">green</a>
.myButton {
background-color:#44c767;
border-radius:28px;
border:1px solid #18ab29;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:Arial;
font-size:17px;
padding:16px 31px;
text-decoration:none;
text-shadow:0px 1px 0px #2f6627;
}
.myButton:hover {
background-color:#5cbf2a;
}
.myButton:active {
position:relative;
top:1px;
}
Example 3: css size button
button {
font-size: 20px; /* Put your wanted size for your button here*/
}
Example 4: change button size css
.test{
height:200px;
width:200px;
}
Example 5: html button size
transform: scale(4); /* This will make the component 4 times bigger */
Example 6: how to set button width in javascript
var buttonShort = document.createElement("button");
buttonShort.innerHTML = "Generate Short Password";
var body = document.getElementsByTagName("body")[0];
buttonShort.style.width = '200px'; // setting the width to 200px
buttonShort.style.height = '200px'; // setting the height to 200px
buttonShort.style.background = 'teal'; // setting the background color to teal
buttonShort.style.color = 'white'; // setting the color to white
buttonShort.style.fontSize = '20px'; // setting the font size to 20px
body.appendChild(buttonShort);
buttonShort.addEventListener("click", function() {
var newWindow = window.open();
newWindow.document.write("The generated Password is: '" + short() + "'");
newWindow.focus();
});