When I maximize the browser, everything aligns perfectly as planned. However, resizing the window causes my divs to overlap. Despite trying several similar posts on this issue without success, I have decided to share my own code.
CODE:
$(document).ready(function(){
for(var i = 1; i <= (32*16); i++){
$('.container').append("<div class=\"squares\" ></div>");
}
var $sqrs = $('.squares');
$sqrs.height("32px");
$sqrs.width("32px");
$sqrs.css("background", "#969696");
$sqrs.css("float", "right");
$sqrs.css("border-style", "solid");
$sqrs.css("border-width", "0");
$sqrs.on("mouseenter", function(){
$(this).addClass("sqr1");
$('.sqr1').css("background", "grey");
});
$('.item').click(function(){
var numSqrs = parseFloat(prompt("How many squares do you want? (1-"));
})
})
body{
width: 100%;
margin: auto;
}
.wrap{
margin-left:auto;
margin-right:auto;
width:100%;
display: inline-block;
}
.top {
position: relative;
top: 0;
left: 0;
z-index: 999;
width: 100%;
height: 55px;
border-bottom: 1px solid #A3A3A3;
-webkit-box-shadow: -1px 2px 12px 0px rgba(0,0,0,0.15);
-moz-box-shadow: -1px 2px 12px 0px rgba(0,0,0,0.15);
box-shadow: -1px 2px 12px 0px rgba(0,0,0,0.15);
display: inline-flex;
}
.bottom{
margin-left:auto;
margin-right:auto;
width:100%;
position:relative;
display: inline-flex;
height: auto;
}
.container{
height: 512px;
width:1024px;
position: fixed;
left:20%;
border: 1px solid #A3A3A3;
top: 10%;
-webkit-box-shadow: 28px 36px 73px -13px rgba(0,0,0,1);
-moz-box-shadow: 28px 36px 73px -13px rgba(0,0,0,1);
box-shadow:28px 36px 73px -13px rgba(0,0,0,1);
}
<!DOCTYPE html>
<html>
<head>
<title>Unique Javascript/jQuery Project Title</title>
<link rel="stylesheet" type="text/css" href="unique-styles/main.css"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src="scripts/jquery-1.0.min.js"></script>
</head>
<body>
<div class="wrap">
<div class="top">
<div id="box">
<img class="head" src="images/unique-image.png"/>
</div>
<p class="Odin">The Unique Odin Project</p>
<p id="proj" class="Odin">Harsimran Mann's Unique Etch-A-Sketch Project</p>
</div>
<div class="bottom">
<div class="scd">
<div class="menu">
<div class="item">
<img id="trash" src="images/unique-grid-image.png"/>
<span class="item1"> New Grid </span>
</div>
<div class="item">
<img id="trash" src="images/unique-trash-image.png"/>
<span class="item1"> Clear </span>
</div>
</div>
<div class="container"></div>
</div>
</div>
</body>
</html>