I have been trying to complete a small exercise and I have it running in codepen but when I put it through sublime and open it in my browser it doesn't show anything! I have tried running it through JSHint, read over and over it. Would love if someone one could please take a moment to have a quick read through. ..This is what it's supposed to do.. http://codepen.io/hellojessicagraham/pen/Ropgob
var htmlDot = "";
var red;
var green;
var blue;
var rgbColor;
function colourSelect() {
return Math.floor(Math.random() * 256 );
}
for(var i = 1; i<=100; i+=1) {
red = colourSelect();
green = colourSelect();
blue = colourSelect();
rgbColor = "rgb(" + red + "," + green + "," + blue + ")";
htmlDot += "<div style=\"background-color:"+ rgbColor + " \"></div>";
}
document.write(htmlDot);
The HTML is as follows
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="main.css">
</head>
<body>
<script src="script.js"></script>
</body>
</html>
CSS as follows
div{
width: 50px;
height: 50px;
display: inline-block;
border-radius: 50%;
margin: 5px;
}
Thank you in advance
Since it seems to work with all the code on your html document, are you sure the links to your js/css files are correct ? Use the inspector in your navigator (F12) if you're not sure.
Edit : It's just working fine. Like Dejan said, your error is probably in your stylesheet.