Article 5MBD4 Javescript - Can't add spaces/tabs to indent/center line on page

Javescript - Can't add spaces/tabs to indent/center line on page

by
pizzipie
from LinuxQuestions.org on (#5MBD4)
Using Ubuntu 20.04

I am trying to indent a line to center it on the page. I am using document.write() to do this:

Code:<script type="text/javascript" >

document.write("&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;Referred By:&emsp;"+document.referrer);
document.write("&emsp;This file:&emsp;"+document.location);
document.write("&emsp;Last Modified:&nbsp;"+"<?php echo $lastModifiedDatetime; ?>");
document.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<hr style='width:80%;' </style>");

</script>All these &emsp;'s and &nbsp;'s don't do anything after about a few spaces. I've tried * and it is no different. As you can see on the screenshot the line beginning with "Referred By:" Should be further to the right by more than a few spaces.

I sure everyone wonders why the Javascript coders haven't written a function to do this.

Totally frustrated, R
Attached Thumbnailsattachment.php?attachmentid=36810&stc=1& latest?d=yIl2AUoC8zA latest?i=17hI8rVzXiM:-z5jZzbB0FA:F7zBnMy latest?i=17hI8rVzXiM:-z5jZzbB0FA:V_sGLiP latest?d=qj6IDK7rITs latest?i=17hI8rVzXiM:-z5jZzbB0FA:gIN9vFw17hI8rVzXiM
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments