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();
});

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
how to set button width in javascript button height width in html width button how to get width and height of button in javascript javascript button size javascript button width height increase width of a button how to change button height and width in html html button width and height set width of button how to change the size of a button js how to increase the width of a button change width of button set width and height of button in css set width and height of button in html how to increase width of button should i give width and height to button how to set the width of button to width of screen change width and height of a button hwo to set button height and width change button size by javascript how to change width and height of button in html creating a button in javascript to change size of a heading css set button width button width in html how to define width and hieght of a button js how to change width button increase button width html button height width css button width properties in js set the size of a button how to change the width and height of a button in html how to change the width of buttons hoq to change width of a button html button width button size javascript width of button html wide button width how to adjust width of a button in css size of button javascript how to give width to eleveted button button width and height in html button height and width in html change height and width of button how to set button width and height in html properties how to set button width and height in html how to change button size in js make a button take the whole width button height and width set attribute height width button js how to set the width of button set button width in html increase width of button make a button take all the width how to set the width of a button in js javascript chagne the width of a button increase width and length of button css button height and width html width button css how to set button height and width in css change button size javascript set button width and height button width element html width of a button css width and height of button html button lower size javascript make button a size js how to measure buttons sizes in javascript using width on a button css make a div width buttons inside javascript button width html cant change width of button set width to auto button javascript change height and width of a button button width css javascript button layout width html button size width how can i contain a button width in to a div css get width of button button width how t o set button width set width of button css set width of buttons in html set size button css change button size js javascript button width css button fixed size w3s change size of button javascript how to change the size of a button in javascript how to make button width 50% increase the size of button in html set button width in css javascript .style.width how to change css width by javascript
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source