The first problem that your HTML document does not show anything is because
dates
is undefined in your JavaScript and breaks the code execution before anything is written to DOM. Maybe you wanted to write this:
let content = "days, " + dates + "/" + months + "/" + years;
There are a bunch of ethical problems with your HTML code. The first one being this:
document.body.innerHTML = days + ", " + dates + "/" + months + "/" + years;
You are using the
innerHTML
and passing a random string text. Try wrapping the content in an HTML element and then setting it to the
innerHTML
of
body
element. This might work:
document.body.innerHTML = "<p>days, " + dates + "/" + months + "/" + years + "</p>";
Now, if you apply some styling to a
<p>
element, it will be visible if CSS file is loaded properly.
p {
color: red;
}
One more thing to note here is that if the color doesn't change, you should check the browser console to see if the file is loaded or there are issues. Use
F12 to launch the console.
Check this here:
Edit fiddle - JSFiddle - Code Playground[
^]