How can I vertically center text in a Button in Intro to App Lab?
@ nrafferty I had the same question myself. It seems that about the only way of accomplishing this is to use CSS, but, AFAIK, the Code dot org App Lab doesn’t support DOM type Javascript which is nested in an HTML container.
Perhaps after you’ve finished with the Javascript code in the App Lab project, you could create a new Web Lab project and paste in the Javascript. Then all you’d need to do is create the button via HTML eg. : <button type="button" style="text-align: center;" id="myButton"></button>
. Then, in your Javascript code, you can access the button via eg. :
var myButton = document.getElementById(“myButton”);
Hope this helps.
Regards,
jdb2
1 Like