So, I have a container div with fixed width and height, and using jQuery to create grid divs inside of it, based on my input. The problem is I need borders on the grid, and they add space so divs don't fit inside the container. I found box-sizing: border-box property, but it does nothing for some reason. Initially I thought that maybe I needed -webkit- prefix since I'm using Chrome, but it's not that.
Any help? Bear in mind I just started learning.
HTML:
<DOCTYPE html>
<html>
<head>
<title>jQuery Sketch-pad</title>
<link rel="stylesheet" href="css/sketch-pad.css">
</head>
<body>
<div id="container">
</div>
<button id="clear-grid">Clear grid</button>
<script src="js/jquery-3.1.0.min.js"></script>
<script src="js/sketch-pad.js"></script>
</body>
</html>
CSS:
#container {
margin: 30px auto;
border: 1px solid red;
height: 960px;
width: 960px;
}
#container > div {
border: 1px solid black;
display: inline-block;
box-sizing: border-box;
}
.hovered {
background-color: black;
}