HTML:
<!DOCTYPE html>
<html>
<head>
<title>Test Menu</title>
<link rel='stylesheet' type='text/css' href='stylesheet.css'/>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type='text/javascript' src='script.js'></script>
</head>
<body>
<a href="index.html"><div id="home">Home</div></a>
<a href="about.html"><div id="about">About Us</div></a>
<a href="contact.html"><div id="contact">Contact</div></a>
</body>
</html>
stylesheet.css:
div {
background-color: #B3B3B3;
transition: background-color 0.5s ease;
display:inline;
font-size:20px;
padding:15px;
padding-bottom:5px;
padding-right:7px;
padding-left:7px;
border:2px solid black;
color:black;
position:relative;
}
a{
text-decoration:none;
}
.active {
background-color:#556677;
}
script.js:
$(document).ready(function(){
//hover menu
$('div').hover(function(){
$(this).addClass('active');
},function(){
$(this).removeClass('active');
});
});
If you were to run this, it would look like this. However, I want it like that, but without any of the white space. I realize float:left
; would kind of solve this, but I don't want the white space on the far left and I want the border to overlap (i.e so it doesn't join together and become 4px on the edges)
Thank you for any and all help!
EDIT: Thanks you all so much for helping, I understand my problem and how to fix it a lot more now!