1. js get page width and height and screen resolution
The visible area width of the web page: document.body.clientWidth The visible area height of the web page: document.body.clientHeight The visible area width of the web page: document.body.offsetWidth (including the width of the edge line) The visible area height of the web page: document.body.offsetHeight (including the width of the edge line) Full text width of the web page: document.body.scrollWidth Web page text full text height: document.body.scrollHeight Web page rolled away height: document.body.scrollTop Web page rolled away left: document.body.scrollLeft Web page text part: window.screenTop Web page text part left: window.screenLeft Screen resolution height: window.screen.height Screen resolution width: window.screen.width Screen available workspace height: window.screen.availHeight Screen available workspace width: window.screen.availWidth
2. js get input length
document.getElementById("input id value").style.width = document.body.scrollWidth * 0.24 - 550;3. Center and align the input input box
<input type="text" style="text-align:center;" />