I'm having trouble with keeping the image inside my div element as it keeps stretching outside of it. I've tried researching for a solution but haven't been successful in finding one. Any help would be greatly appreciated!
Here is the HTML/CSS code snippet...
.navigation {
padding-top: 70px;
padding-bottom: 70px;
position: relative;
text-transform: uppercase;
}
.container {
}
.brand-text {
font-family: Georgia, Times, 'Times New Roman', serif;
font-size: 40px;
font-weight: 700px;
color: black;
-webkit-transition: color 700ms ease;
text-align: center;
}
.brand-text:hover {
color: grey;
}
.nav-brand {
text-decoration:none;
}
.nav-menu {
text-align: center;
}
.nav-link {
padding-top: 7px;
padding-bottom: 7px;
margin-right: 20px;
margin-left: 20px;
text-decoration: none;
color: black;
font-family: Georgia, Times, 'Times New Roman', serif;
-webkit-transition: color 700ms ease;
position: relative;
}
.nav-link:hover {
color: grey;
}
a {
text-decoration: none;
}
div.img {
margin: 5px;
float: left;
width: 180px;
-webkit-transition: opacity 400ms ease, box-shadow 400ms ease;
transition: opacity 400ms ease, box-shadow 400ms ease;
background-color: #fff;
}
div.img:hover {
background-color: transparent;
box-shadow: 0 0 50px -14px #000;
opacity: 0.8;
}
div.img img {
width: 100%;
height: auto;
}
div.desc {
text-align: center;
color: black;
padding: 15px;
}
* {
box-sizing: border-box;
}
@media only screen and (max-width: 700px){
.reponsive {
width: 49.999999%;
margin: 6px;
}
}
@media only screen and (max-width: 500px){
.responsive {
width: 100%
}
}
.clearfix:after {
content: "";
display: table;
}
<!DOCTYPE html>
<html>
<head>
<title>Josh Corbett</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<div class="navigation">
<div class="container">
<a class="nav-brand" href="#"><h1 class="brand-text">Josh Corbett</h1></a>
<nav class="nav-menu" role="navigation">
<a class="nav-link" href="#">Portfolio</a>
<a class="nav-link" href="#">About</a>
<a class="nav-link" href="#">Contact</a>
<a class="nav-link" href="#">Blog</a>
</nav>
</div>
</div>
<div class="responsive">
<div class="img">
<a target="_blank" href="#">
<img src="http://wallpaperwarrior.com/wp-content/uploads/2016/09/Wallpaper-1-1024x640.png" alt="Mountain" width="300" height="200">
<div class="desc">Beautiful Montain</div>
</a>
</div>
</div>
</body>