Preface: This is for a homework assignment. The final assignment is building a weather website. This particular portion of the assignment is to build a gallery of weather pictures. In a smaller mobile view the pictures should display in a single column. In the medium view they should display in two columns, and in the large view in three columns. I got it working but then at some point made a change that broke it and I cannot get it working again. I am posting the html portion for the images and the css files for the small, medium, and large views. The small view is working well. Any hints or corrections will be greatly appreciated. Thank you.
<div class="grid">
<div class="griditem"><img src="images/gallery-hurricane150.jpg" alt="hurricane from space" class="imgone"><p class="description1"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras malesuada.</p></div>
<div class="griditem"><img src="images/gallery-ice-storm150.jpg" alt="car in ice-storm" class="imgtwo"><p class="description1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras malesuada.</p></div>
<div class="griditem"><img src="images/gallery-lightningsun150.jpg" alt="image showing both lightning and rays of sun" class="imgthree"><p class="description1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras malesuada.</p></div>
<div class="griditem"><img src="images/gallery-snowstorm150.jpg" alt="car driving in snowstorm" class="imgfour"><p class="description1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras malesuada.</p></div>
<div class="griditem"><img src="images/gallery-tornado150.jpg" alt="A tornado" class="imgfive"><p class="description1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras malesuada.</p></div>
<div class="griditem"><img src="images/gallery-rainbow150.jpg" alt="A double rainbow over a valley" class="imgsix"><p class="description1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras malesuada.</p></div>
</div>
Small VIEW
* { box-sizing: border-box;} /* This wildcard applies to all elements ensuring a box layout model */
body {
font-size: 16px;
font-family: sans-serif; /* Declare the base font-family */
background-color: mediumspringgreen;
max-width: 600px;
margin-left: auto;
margin-right: auto;
}
header, nav, main, footer { /* the comma between the selectors means apply the following CSS declarations to all of the listed elements */
max-width: 100%; /* Declare the maximum width and other main element rules to limit the stretch on larger/wider views */
}
header {
display: block;
text-align: left;
margin: 10px;
}
main {
padding-left: 5px;
}
main figure { margin: 0 0 .2rem 2%; width:96%; }
footer {
display: flex;
flex-direction: column;
border-top:solid 1px black;
text-align:center;
/*bottom:0;
width:100%;*/
margin-top:25px;
background-color: bisque;
}
a {
color:black;
text-decoration:none;
font-weight:600;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
h1 {
font-size: 40px;
font-weight: 700;
margin: 5px 20px;
}
.title {
margin-left: 25px;
margin-top: 20px;
font-family: 'Oxygen', sans-serif;
font-size: 1.1em;
}
.active {
position: relative;
padding-top: 35px;
font-family: 'PT Sans Narrow', sans-serif;
font-size: 3em
}
.company {
display: inline;
position: absolute;
}
.navbar {
margin-bottom: 20px;
}
.nav {
/*display: inline;*/
display: inline-flex;
flex-flow: row;
border-top: solid 1px black;
padding: 10px;
background-color: cyan;
}
.logo {
max-height: 150px;
}
.sun {
max-height: 70px;
}
a:hover {
color: red;
text-decoration: none;
}
.navbar.responsive {
display: block;
}
.griditem:hover {
box-shadow: 3px 10px;
}
.griditem {
border: 1px solid black;
padding: 5px;
}
@media only screen and (max-width: 37.5em) {
.nav {
display: block;
}
.navbar {
display: none;
}
header {
height: 225px;
}
body {
min-width: 450px;
}
.sun {
padding-right: 4px;
}
.hamburger {
display: inline;
position: absolute;
top: 180px;
left: 25px;
padding: 4px 13px;
font-size: 30px;
}
.sunny {
float: left;
}
.rain {
max-height: 70px;
float: right;
}
table, .tenday {
display: none;
}
.high {
float: left;
}
.contact, .bar {
font-size: 10px;
}
.grid {
display:grid;
grid-template-columns: auto;
grid-template-rows: auto;
grid-row-gap: 25px;
grid-row-gap:25px;
justify-content: center;
text-align: center;
margin-top: 20px;
margin: 0% 3%;
}
.imgone {
grid-column-start: 1;
grid-row-start: 1;
}
.imgtwo {
grid-column-start: 1;
grid-row-start: 2;
}
.imgthree {
grid-column-start: 1;
grid-row-start: 3;
}
.imgfour {
grid-column-start: 1;
grid-row-start: 4;
}
.imgfive {
grid-column-start: 1;
grid-row-start: 5;
}
.imgsix {
grid-column-start: 1;
grid-row-start: 6;
}
.description1, .description2, .description3, .description4, .description5, .description6 {
width: 200px;
}
}
MEDIUM VIEW
@media only screen and (min-width: 37.5em) {
@media only screen and (max-width: 63.9em) {
/* Only CSS write declarations that need to be changed. Do not duplicated declarations that are already established in the main.css */
/*nav button { display:none; } hamburger button does not need to be shown in the medium on up views */
section.forecast {
display: inline-flex;
justify-content: center;
} /* show the 10-day forecast with the medium view and up */
.hamburger {
display:none;
}
footer {
font-size: 18px;
}
.rain {
float: right;
height: 120px;
}
.article {
border: 1px solid gray;
margin-top: 10px;
}
/*.sign {
float: left;
}*/
.sun {
float: left;
max-height: 70px;
padding-right: 8px;
padding-left: 5px;
}
.high,.low,.precip,.wind {
margin-bottom: 10px;
}
th, td {
border: 1px solid black;
padding-right: 8px;
text-align: center;
}
.stats {
display: flex;
justify-content: space-around
}
.franklin {
display: flex;
justify-content: center;
}
.grid {
display:grid;
grid-template-columns: auto auto;
grid-template-rows: auto auto;
grid-row-gap: 25px;
grid-row-gap:25px;
grid-column-gap: 25px;
justify-content: center;
text-align: center;
margin-top: 20px;
margin: 0% 3%;
}
.imgone {
grid-column-start: 1;
grid-row-start: 1;
}
.imgtwo {
grid-column-start: 1;
grid-row-start: 2;
}
.imgthree {
grid-column-start: 1;
grid-row-start: 3;
}
.imgfour {
grid-column-start: 1;
grid-row-start: 4;
}
.imgfive {
grid-column-start: 1;
grid-row-start: 5;
}
.imgsix {
grid-column-start: 1;
grid-row-start: 6;
}
.description1, .description2, .description3, .description4, .description5, .description6 {
width: 200px;
}
}
}
LARGE VIEW
@media only screen and (min-width: 64em ) {
.hamburger {
display:none;
}
.sign {
width: auto;
}
.weather {
position: relative;
}
.now {
/*width: 575px;
height: 100px;
position: absolute;
text-align: center;*/
position: absolute;
top: -10px;
right: 55px
}
h2 {
margin: 0;
padding-bottom: 10px;
}
/*.sun {
position: absolute;
top: 8px;
left: 16px;
}*/
.rain {
float: right;
height: 120px;
}
th, td {
border: 1px solid black;
padding-right: 8px;
text-align: center;
}
/*.stats {
display: absolute
padding-top: 5px;
position: absolute;
left: 115px;
}
h2 {
margin: 0;
padding-bottom: 5px;
position: relative;
right: 115px;
}*/
/*.franklin {
position: absolute;
right: 50px;
}*/
.sunny, .high, .low, .precip, .wind {
padding-bottom: 3px;
}
.grid {
display: grid;
grid-template-columns: auto auto auto;
grid-row-gap: 25px;
grid-row-gap: 25px;
grid-column-gap: 25px;
justify-content: center;
text-align: center;
margin-top: 20px;
margin: 0% 3%;
}
.imgone {
grid-column-start: 1;
grid-row-start: 1;
}
.imgtwo {
grid-column-start: 1;
grid-row-start: 2;
}
.imgthree {
grid-column-start: 1;
grid-row-start: 3;
}
.imgfour {
grid-column-start: 1;
grid-row-start: 4;
}
.imgfive {
grid-column-start: 1;
grid-row-start: 5;
}
.imgsix {
grid-column-start: 1;
grid-row-start: 6;
}
.description1, .description2, .description3, .description4, .description5, .description6 {
width: 150px;
}
}