Upon integrating a basic javascript function into my website to request data from another source, I noticed that the text in the header div suddenly shifts left and then centers itself while the site is loading. This strange movement occurs every time the browser is refreshed.
I suspect that the issue may be related to my div layout or CSS styling. Although I acknowledge that my code is not flawless, it's unclear whether this specific problem stems from it or persists despite it.
Any suggestions on how to resolve this?
body {
font-family: 'Roboto', sans-serif;
max-width: 1000px;
margin: 0 auto;
padding: 15px;
}
#hello {
display: inline-block;
text-align: center;
}
#logo {
font-weight: 900;
font-size: 2em;
margin-bottom: 15px;
}
#output {
font-family: 'Roboto';
font-size: 40px;
font-weight: 900;
display: block;
}
<html>
<head>
<link type="text/css" rel="stylesheet" href="/myip-jerktest.css">
</head>
<body>
<div id="hello">
<div id="logo">
Text Logo Here
</div>
<span id="output">
<script>
function getIP(json) {
document.write(json.ip);
}
</script>
<script src="https://api.ipify.org?format=jsonp&callback=getIP">
</script>
</span>
<div style="width:400px;height:45px">
</div>
</div>
</body>
</html>