how to set button in the middle of screen in js
help me pls i have button and i need to set it in the middle for all devices not only one i am making a interface and i want to button stay in the middle and i cant use transform because i will move this button after clicking it i tried this function centerObject (obj) { obj.style.marginTop = (window.innerHeight / 2) - (obj.offsetHeight) + "px" obj.style.marginLeft = (window.innerWidth / 2) - (obj.offsetWidth)+ "px" } and this margin: auto; but it isnt work good sorry for bad english
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.