简体   繁体   中英

button position issue using javascript

I have below two lines of code. show1 and show2 are buttons on my JSP Page that position according to below code. However, button show2 is displayed little lower that button show1. How to resolve this issue.

  document.getElementById('show1').style.marginTop="33%";

  document.getElementById('show2').style.marginTop="33%";

Make sure you are using position: absolute; for each of them.

document.getElementById('show1').style.position = 'absolute';
document.getElementById('show2').style.position = 'absolute';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM