简体   繁体   中英

Positioning Javascript Tag on HTML Page

I'm growing frustrated in positioning my javascript date in the center of my html page. Everything else is centered but the javascript date.

Here's a screenshot:

在此处输入图片说明

My HTML:

<section>
<a href="http://validator.w3.org/check?uri=http%3A%2F%2Fhills.ccsf.edu%2F~avu%2Fhw1.html" target="_blank"><img id="html5logo"src="images/html5_logo.png" alt="html5" height="50" width="50" /></a>

<a href="http://alturl.com/9kv4o" target="_blank"><img id="csslogo" src="images/css_logo.gif" alt="css" height="50" width="50" /></a>
</section>

<br />

<p id="pagelastupdated">Page last updated:</p>
<script type="text/javascript">
  document.write(document.lastModified);
</script>

And here's my CSS:

section  {
    margin-top: 10px;
    margin-left: auto;
    margin-right: auto;
    width: 112px;
}

section img#html5logo  {
    display: inline;
    margin-left: auto;
    margin-right: auto;
}

section img#csslogo  {
    display: inline;
    margin-left: auto;
    margin-right: auto;
}

#pagelastupdated  {
    text-align: center;
}

script  {
    border: 4px solid purple;
}

PLEASE HELP ME!

You might try (adjusted to show two lines)

<p align="center" id="pagelastupdated">Page last updated:<br/>
<script type="text/javascript">
  document.write(document.lastModified);
</script>
</p>

尝试将结束段落标签移动到结束脚本标签之后,或将日期写入div包裹的文档中,然后将其居中。

您正在p标签之外写日期,这是您正在居中的日期。

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