您好,我正在尝试找出如何居中document.write字符串。任何帮助,将不胜感激谢谢。
之所以需要document.write是因为它是我的作业的一部分。
下面是我要居中并放大的代码。
document.write (username + " " + job + " and the " + technology + " of Destiny" +
"<br><br>Set 3000 years in the future, a down-on-his-luck " + career + " teams up with a robot " + animal + " and a world-famous " + technology +
" hacker to steal the last " + technology + " on Earth from the " + authority + " of the New World Government. <br>This " +
(wholeHours + " Hour " + wholeMinutes + " Minutes ") + "long film stars Nick Cage as Thor " + job +
", and Morgan Freeman as the voice of " + color + " " + animal + " " + getRndInteger(age,videogames));
答案 0 :(得分:1)
使用document.write
时,请向文档中写入标签,并使用text-align: center;
属性将其居中。
document.write('<h3 style="text-align: center;">test</h3>');