[英]How to move the position of a javascript based HTML element with CSS?
I wanted to move the date and time to some what down from the head. 我想将日期和时间从头向下移。 I am not getting how to do that: 我没有怎么做:
/* the CSS which I am using is */ p { text-align: center; margin-top: 15%; }
<p id="demo"></p> <script> document.getElementById("demo").innerHTML = Date(); </script>
but it is not working. 但它不起作用。
Made a fiddle by copying and pasting your code... Seems to work just fine for me. 通过复制和粘贴代码来进行摆弄……似乎对我来说很好。
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Date();
</script>
Putting that in the html field is all you need, but I can't say why it isn't working in your code. 您只需要把它放在html字段中,但是我不能说为什么它在您的代码中不起作用。 Check for tags you haven't closed, extra or missing ', ", /, etc... 检查您尚未关闭的标签,多余或缺少“,”,/等...
https://jsfiddle.net/of8692m3/ https://jsfiddle.net/of8692m3/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.