Responsive Boxes with Images

Developer
Size
3,915 Kb
Views
44,528

How do I make an responsive boxes with images?

So here's the deal: you have a bunch of elements (BOXES) with images in them. You want them to resize responsively. Using just float: left or display: inline ain't gonna cut it because you want them to span the entire width of the screen! Don't worry, Sass's got your back.. What is a responsive boxes with images? How do you make a responsive boxes with images? This script and codes were developed by Andy McFee on 09 August 2022, Tuesday.

Responsive Boxes with Images Previews

Responsive Boxes with Images - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Responsive Boxes with Images</title> <script src="http://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script>
<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1>Responsive Boxes with images</h1>
<h2>Check out <a href="http://codepen.io/andymcfee/pen/grAGC" targert="_blank">this pen</a> for an even better way to do this</h2>
<div class="box-container"> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div> <div class="box"><img src="http://placekitten.com/g/400/400" alt=""></div>
</div>
<p>So here's the deal: you have a bunch of elements (BOXES) with images in them. You want them to resize <strong>responsively</strong>. Using just <code>float: left</code> or <code>display: inline</code> ain't gonna cut it because you want them to span the entire width of the screen! Don't worry, Sass's got your back.</p>
<p>Don't want to use Images? <a href="http://codepen.io/andymcfee/pen/ABboI" target="_blank">Use jQuery</a></p>
<p>Check out <a href="http://codepen.io/andymcfee/pen/grAGC" targert="_blank">this pen</a> for an even better way to do this</p> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
</body>
</html>

Responsive Boxes with Images - Script Codes CSS Codes

body { text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.25); background: #333; color: #a7a7a7; font-family: "HelveticaNeue-CondensedBold", "Open Sans Condensed", "Helvetica Neue", Helvetica, Arial, sans-serif; margin: 0; padding: 0; text-align: center;
}
h1, h2 { display: block; margin: 20px auto 0; padding: 0; text-align: center; text-transform: uppercase;
}
h2 { font-size: 13px; margin: 0 auto 20px;
}
a { color: #FFF; text-decoration: underline;
}
p { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5) inset; -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5) inset; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5) inset; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; background: rgba(255, 255, 255, 0.05); display: block; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 18px; font-weight: normal; line-height: 1.5em; margin: 20px auto; max-width: 500px; padding: 20px; text-align: left;
}
@media (max-width: 540px) { p { margin: 20px; }
}
.box-container { overflow: hidden; *zoom: 1;
}
.box { display: block; float: left; margin: 0; padding: 0; width: 100%;
}
.box img { float: left; margin: 0; max-width: 100%; opacity: 0.5; padding: 0;
}
.box:nth-child(1) { background: #ff006f;
}
.box:nth-child(2) { background: #ff0037;
}
.box:nth-child(3) { background: red;
}
.box:nth-child(4) { background: #ff3700;
}
.box:nth-child(5) { background: #ff6f00;
}
.box:nth-child(6) { background: #ffa600;
}
.box:nth-child(7) { background: #ffdd00;
}
.box:nth-child(8) { background: #eaff00;
}
.box:nth-child(9) { background: #b3ff00;
}
.box:nth-child(10) { background: #7bff00;
}
.box:nth-child(11) { background: #44ff00;
}
.box:nth-child(12) { background: #0dff00;
}
.box:nth-child(13) { background: #00ff2b;
}
.box:nth-child(14) { background: #00ff62;
}
.box:nth-child(15) { background: #00ff99;
}
.box:nth-child(16) { background: #00ffd0;
}
.box:nth-child(17) { background: #00f7ff;
}
.box:nth-child(18) { background: deepskyblue;
}
.box:nth-child(19) { background: #0088ff;
}
.box:nth-child(20) { background: #0051ff;
}
.box:nth-child(21) { background: #001aff;
}
.box:nth-child(22) { background: #1e00ff;
}
.box:nth-child(23) { background: #5500ff;
}
.box:nth-child(24) { background: #8c00ff;
}
.box:nth-child(25) { background: #c400ff;
}
.box:nth-child(26) { background: #fb00ff;
}
.box:nth-child(27) { background: #ff00cc;
}
.box:nth-child(28) { background: #ff0095;
}
.box:nth-child(29) { background: #ff005e;
}
.box:nth-child(30) { background: #ff0026;
}
.box:nth-child(31) { background: #ff1100;
}
.box:nth-child(32) { background: #ff4800;
}
.box:nth-child(33) { background: #ff8000;
}
.box:nth-child(34) { background: #ffb700;
}
.box:nth-child(35) { background: #ffee00;
}
.box:nth-child(36) { background: #d9ff00;
}
.box:nth-child(37) { background: #a2ff00;
}
.box:nth-child(38) { background: #6aff00;
}
.box:nth-child(39) { background: #33ff00;
}
.box:nth-child(40) { background: #00ff04;
}
.box:nth-child(41) { background: #00ff3c;
}
.box:nth-child(42) { background: #00ff73;
}
.box:nth-child(43) { background: #00ffaa;
}
.box:nth-child(44) { background: #00ffe1;
}
.box:nth-child(45) { background: #00e6ff;
}
.box:nth-child(46) { background: #00aeff;
}
.box:nth-child(47) { background: #0077ff;
}
.box:nth-child(48) { background: #0040ff;
}
.box:nth-child(49) { background: #0009ff;
}
.box:nth-child(50) { background: #2f00ff;
}
.box:nth-child(51) { background: #6600ff;
}
.box:nth-child(52) { background: #9d00ff;
}
.box:nth-child(53) { background: #d500ff;
}
.box:nth-child(54) { background: #ff00f2;
}
.box:nth-child(55) { background: #ff00bb;
}
.box:nth-child(56) { background: #ff0084;
}
.box:nth-child(57) { background: #ff004d;
}
.box:nth-child(58) { background: #ff0015;
}
.box:nth-child(59) { background: #ff2200;
}
.box:nth-child(60) { background: #ff5900;
}
@media (min-width: 200px) { .box { width: 50%; }
}
@media (min-width: 400px) { .box { width: 33.33333%; }
}
@media (min-width: 600px) { .box { width: 25%; }
}
@media (min-width: 800px) { .box { width: 20%; }
}
@media (min-width: 1000px) { .box { width: 16.66667%; }
}
@media (min-width: 1200px) { .box { width: 14.28571%; }
}
@media (min-width: 1400px) { .box { width: 12.5%; }
}
@media (min-width: 1600px) { .box { width: 11.11111%; }
}
@media (min-width: 1800px) { .box { width: 10%; }
}
@media (min-width: 2000px) { .box { width: 9.09091%; }
}
@media (min-width: 2200px) { .box { width: 8.33333%; }
}
@media (min-width: 2400px) { .box { width: 7.69231%; }
}
@media (min-width: 2600px) { .box { width: 7.14286%; }
}
@media (min-width: 2800px) { .box { width: 6.66667%; }
}
@media (min-width: 3000px) { .box { width: 6.25%; }
}
@media (min-width: 3200px) { .box { width: 5.88235%; }
}
@media (min-width: 3400px) { .box { width: 5.55556%; }
}
@media (min-width: 3600px) { .box { width: 5.26316%; }
}
@media (min-width: 3800px) { .box { width: 5%; }
}
@media (min-width: 4000px) { .box { width: 4.7619%; }
}
Responsive Boxes with Images - Script Codes
Responsive Boxes with Images - Script Codes
Home Page Home
Developer Andy McFee
Username andymcfee
Uploaded August 09, 2022
Rating 3
Size 3,915 Kb
Views 44,528
Do you need developer help for Responsive Boxes with Images?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Andy McFee (andymcfee) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!