This code is not working
var span = document.getElementById("span");
span.style.fontsize = "25px";
span.innerHTML = "String";
This question is related to
javascript
css
fonts
font-size
span.style.fontSize = "25px";
use this
Please never do this in real projects:
document.getElementById("span").innerHTML = "String".fontsize(25);
_x000D_
<span id="span"></span>
_x000D_
try this:
var span = document.getElementById("span");
span.style.fontSize = "25px";
span.innerHTML = "String";
<span id="span">HOI</span>
<script>
var span = document.getElementById("span");
console.log(span);
span.style.fontSize = "25px";
span.innerHTML = "String";
</script>
You have two errors in your code:
document.getElementById
-
This retrieves the element with an Id that is "span", you did not specify an id on the span-element.
Capitals in Javascript - Also you forgot the capital of Size.
Source: Stackoverflow.com