I am developing my portfolio website but I am encountering some issues in different browsers. When I go to the website in Firefox and hover over an img element scrollbars pop up and suddenly I can scroll through the entire document (left, right, up and down). I feel like this is a Firefox issue since I only encounter this issue there and not in any other browsers.
You can find the website here nadiasportfolio.tumblr.com
$(document).ready(function() {
$("#NEW").delay(250).fadeIn(1000);
$("#MEDIA").delay(850).fadeIn(1000);
$("#NEWB").delay(1600).fadeIn(1000);
// $(".thumbnail").each(function(i){
// $(this).attr("id", "thumbnail" + i);
// });
$(".content").each(function(i) {
$(this).attr("id", "content" + i);
});
$(".thumbnail").addClass("color-hover");
$(".pdf").addClass("color-hover");
$(".content > img").addClass("color-hover");
$(".content").hide();
$("#toggleHeader").html("");
setTimeout(function() {
$("header").trigger('click');
}, 3000);
$("header").on("click", headerScrollUp);
$("header a").click(function(evt) {
evt.stopPropagation();
});
$("#toggleHeader").on("click", headerScrollDown);
$(".thumbnail").on("click", toggleContent);
$(".pdf").on("click", changeSizePDF);
});
var viewportWidth = $(window).width();
var viewportHeight = $(window).height();
$(window).on("resize", function(event) {
// "if (x !== undefined){}" -> does not scroll back to horizontal 0
// but is all over the place
// if (x !== undefined) {
scrollToCurrent = ($(window).width() * 1.015 * x - $(window).width());
$("section").animate({
scrollLeft: scrollToCurrent
}, 10);
$(".pdf").children("img").css("height", "8vh").css("width", "auto").css("cursor", "zoom-in");
// }
});
var x;
var scrollToCurrent;
function headerScrollUp() {
$("header").animate({
height: "0vh"
}, 1000);
$("#toggleHeader").html("≡");
}
function headerScrollDown() {
$("header").animate({
height: "100vh"
}, 1000);
$("#toggleHeader").html("");
}
function toggleContent() {
if ($(this).next(".content").is(":hidden") === true) {
x = $(this).parent().index() + 1;
// scrollToCurrent = ($(window).width() * 1.0 * x - $(window).width());
console.log(this);
scrollToCurrent = (($(this).width() + 8) * x - ($(this).width() + 8));
$("section").animate({
scrollLeft: scrollToCurrent
}, 500);
$(this).delay(500).next(".content").show();
$(this).parent().siblings().css("opacity", "0");
$("section").css("overflow-x", "hidden");
$("section").css("overflow-y", "initial");
$("section").animate({
scrollTop: viewportHeight / 2 + "px"
}, 500);
$(".toggleText").css("transform", "scaleY(-1)");
// $(".toggleText").animate({transform: "rotate(90deg)"}, 500);
} else {
//animatie werkt niet ??
$(".toggleText").css("transform", "scaleY(1)");
$("section").animate({
scrollTop: "-=1000px"
}, 100);
$(this).delay(100).next(".content").hide();
$(this).parent().siblings().css("opacity", "100");
$("section").css("overflow-x", "initial");
$("section").css("overflow-y", "hidden");
}
}
function changeSizePDF() {
if ($(this).children("img").height() < viewportHeight / 9) {
var heightBig = $(this).children("img").height() * 9;
var widthBig = $(this).children("img").width() * 9;
$(this).children("img").animate({
height: heightBig,
width: widthBig
});
$(this).css("cursor", "zoom-out");
} else {
var heightSmall = $(this).children("img").height() / 9;
var widthSmall = $(this).children("img").width() / 9;
// var ratioToSmall = (viewportHeight / 100 * 8) * $(this).children("img").width() / $(this).children("img").height();
$(this).children("img").animate({
height: heightSmall,
width: widthSmall
});
$(this).css("cursor", "zoom-in");
}
}
.iframe-controls-container,
.iframe-controls-container--logged-in,
.tmblr-iframe,
.tmblr-iframe--desktop-logged-in-controls,
.iframe-controls--desktop {
display: none;
}
* {
margin: 0;
padding: 0;
font-weight: normal;
}
.color-hover {
filter: grayscale(255);
-webkit-filter: grayscale(255);
}
.color-hover:hover {
filter: grayscale(0);
-webkit-filter: grayscale(0);
}
body {
color: white;
background-color: black;
font-family: helvetica;
}
h1 {
font-size: 4vw;
}
h2,
nav a {
font-size: 2.5vw;
margin: auto;
}
h3 {
font-size: 1.5vw;
margin: auto;
}
p {
font-size: 1em;
}
code {
font-family: monospace;
background-color: lightgray;
color: rgba(0, 0, 0, 0.9);
}
::-webkit-scrollbar {
width: 4px;
/* change scrollbar space */
height: 4px;
background: black;
/* optional: just make scrollbar invisible */
}
/* optional: show position indicator in red */
::-webkit-scrollbar-thumb {
background: linear-gradient(to bottom right, #ff00bf, #ff00e9, #b600ff, #9000ff, #3f00ff, #0d00c9);
}
#posts {
display: none;
}
header {
background-color: #ddddff;
height: 100vh;
width: 100vw;
text-align: center;
-webkit-overflow: auto;
overflow: auto;
position: fixed;
z-index: 1;
}
header h1 {
margin-top: 40vh;
}
a {
color: white;
text-transform: uppercase;
}
nav {
position: absolute;
bottom: 1vh;
width: 100vw;
}
nav a {
margin-left: 2vw;
margin-right: 2vw;
cursor: pointer;
}
section {
height: 98vh;
white-space: nowrap;
-webkit-overflow-x: scroll;
-webkit-overflow-y: hidden;
overflow-x: scroll;
overflow-y: hidden;
}
#toggleHeader {
width: 100vw;
background: #ddddff;
opacity: 0.9;
text-align: center;
height: 2vh;
cursor: pointer;
}
article {
/* background-color: darkgray;*/
width: 100vw;
height: 99vh;
display: inline-block;
/*
border-top: 5px solid black;
border-left: 2px solid black;
border-right: 2px solid black;
*/
text-align: center;
}
.thumbnail {
padding: 2%;
width: 100vw;
height: 99vh;
background: radial-gradient(skyblue, midnightblue);
/* background-size: cover;*/
background-size: 50vh;
background-position: center;
background-color: white;
-webkit-overflow-y: hidden;
overflow-y: hidden;
border: 4px solid black;
}
#tn-window-of-sounds {
background-image: url("http://static.tumblr.com/6zouj6x/RyIom7lgk/window_of_sounds_logo.svg");
background-size: 50vh;
/* background-repeat: no-repeat;*/
}
#tn-lets-make {
background-image: url("https://68.media.tumblr.com/dcb2c0ecd7663664d00208b793aeec93/tumblr_ome08qJX761w34hfho3_r1_1280.png");
}
#tn-jumbo {
background-image: url("https://68.media.tumblr.com/1baf77332e4ae9873da8dbf483870f5e/tumblr_omnx7cJ38U1w34hfho2_r1_540.png");
}
#tn-do {
/*gif:*/
/* background-image: url("https://media.giphy.com/media/26FmRuwDb5eFOPDZS/source.gif");*/
/* still image:*/
background-image: url("https://68.media.tumblr.com/4a4f6f8f43e3a3d8ab6ef29967d47491/tumblr_omnu22CYIt1w34hfho1_1280.png");
}
#tn-van-gogh {
background-image: url("https://68.media.tumblr.com/fe28945f60e1d27d89b03f79661b7f1a/tumblr_omo650hbbp1w34hfho1_1280.png");
}
#tn-data-visualisation {
background-image: url("http://static.tumblr.com/6zouj6x/Yonomo9jy/ballonnen_met_mens.svg");
}
#tn-nature-tour {
background-image: url("https://68.media.tumblr.com/7e0c4cc06b662fca87201399ad134d64/tumblr_omocqygQIu1w34hfho1_1280.png");
}
#tn-insect-stamps {
background-image: url("https://68.media.tumblr.com/3c3d875629cd2ced500c9c59c288ca61/tumblr_omt5hkNls91w34hfho9_1280.jpg");
}
.textWrapper {
width: 40vw;
padding: 1vw;
margin: auto;
margin-top: 40vh;
background-color: rgba(0, 0, 0, 1);
cursor: pointer;
}
.textWrapper:hover {
font-family: monospace;
font-weight: thin;
}
.thumbnail h2 {
text-transform: uppercase;
}
.toggleText {
background: url("https://d30y9cdsu7xlg0.cloudfront.net/png/615573-200.png");
background-repeat: no-repeat;
background-size: contain;
background-position: center;
height: 7.5vw;
width: 7.5vw;
margin: auto;
margin-top: 30vh;
/* z-index: -1;*/
cursor: pointer;
}
.content {
padding-top: 5vh;
padding-bottom: 1vh;
display: none;
width: 90vw;
min-height: 500px;
position: sticky;
left: 0;
}
.content p,
.content code {
white-space: normal;
text-align: left;
}
.content p {
padding: 5vw;
padding-top: 1vh;
padding-bottom: 1vh;
}
.content>img {
max-height: 90vh;
max-width: 90vw;
visibility: visible;
}
.background-color-white {
background-color: white;
}
.pdf {
background-color: black;
-webkit-overflow: scroll;
overflow: scroll;
width: 100vw;
text-align: left;
cursor: zoom-in;
}
.pdf img {
height: 10vh;
width: auto;
}
embed {
width: 100vw;
}
.embed-code {
background-color: lightgray;
height: 40vh;
margin: 0;
}
video {
background-color: gray;
max-height: 100vh;
max-width: 100vw;
}
footer {
background-color: blue;
}
/*{CustomCSS}*/
<!DOCTYPE html>
<html>
<head>
<title>Nadias portfolio.</title>
<!-- <link rel="shortcut icon" href="{Favicon}">-->
<link rel="stylesheet" href="index.css">
<meta charset="UTF-8">
<meta name="keywords" content="portfolio, Nadia, van, Leur, CMD, communication, &, and, multimedia, design, jquery, student, javascript, html, css">
<meta name="author" content="Nadia van Leur">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--
{block:Description}
<meta name="description" content="{MetaDescription}" />
{/block:Description}
-->
<script src="https://code.jquery.com/jquery-3.1.1.js"></script>
<script src="index.js"></script>
</head>
<body>
<header>
<h1>Nadias portfolio.</h1>
<nav>
Resume
Nederlands
</nav>
</header>
<div id="toggleHeader" class="color-hover">
≡
</div>
<section>
<!--Window of Sounds app -->
<article>
<div class="thumbnail" id="tn-window-of-sounds">
<div class="textWrapper">
<h2>Window of Sounds</h2>
<h3>Think further than the frame.</h3>
</div>
<div class="toggleText"></div>
</div>
<div class="content" id="content1">
<p>Window of Sounds is an app created for Het Noordbrabants Museum. A museum about the art history of Noord-Brabant.<br></p><br>
<img src="foto mensen koptelefoon"><br>
<img src="foto mensen koptelefoon"><br>
<img src="foto mensen koptelefoon"><br>
<embed class="embed-code" src="http://static.tumblr.com/6zouj6x/nSiomo27n/index.js.txt">
</div>
</article>
<!-- Visuele identiteit Let's Make -->
<article>
<div class="thumbnail" id="tn-lets-make">
<div class="textWrapper">
<h2>Let's Make</h2>
<h3>Visual Identity.</h3>
</div>
<div class="toggleText"></div>
</div>
<div class="content" id="content2">
<p>Test tekst2</p><br>
<img src="https://68.media.tumblr.com/23c916b7cf86e27103acee1e21bc6938/tumblr_ome08qJX761w34hfho1_1280.png">
<img src="https://68.media.tumblr.com/30c0e288a6e406d54792441f9c498c75/tumblr_ome08qJX761w34hfho2_1280.png">
</div>
</article>
<!--Jumbo shopping app -->
<article>
<div class="thumbnail" id="tn-jumbo">
<div class="textWrapper">
<h2>Shopping app design</h2>
<h3>Jumbo supermarket.</h3>
</div>
<div class="toggleText"></div>
</div>
<div class="content" id="content3">
<p>Test tekst3</p><br>
<div class="pdf">
<img src="https://68.media.tumblr.com/1baf77332e4ae9873da8dbf483870f5e/tumblr_omnx7cJ38U1w34hfho2_r1_1280.png">
<img src="https://68.media.tumblr.com/07340d2e8a0fa3279d19685c5d2efe2a/tumblr_omo0gfTM8I1w34hfho9_1280.png">
<img src="https://68.media.tumblr.com/589f872342e4900461e3feb9779d0276/tumblr_omnx7cJ38U1w34hfho1_1280.png">
<img src="https://68.media.tumblr.com/71d4d216751e80c4ff59cb16be2f8676/tumblr_omo0gfTM8I1w34hfho8_1280.png">
<img src="https://68.media.tumblr.com/5b9968c37295813a3321dc5c965e6c96/tumblr_omo0gfTM8I1w34hfho10_1280.png">
<img src="https://68.media.tumblr.com/ea1523e56ac76ae2b2bc35ab5a035823/tumblr_omo0gfTM8I1w34hfho7_1280.png">
<img src="https://68.media.tumblr.com/aa814e094d3aeead9106393b7a644d05/tumblr_omo0gfTM8I1w34hfho6_1280.png">
<img src="https://68.media.tumblr.com/02add0021cf9bae65d227056e133b45e/tumblr_omo0gfTM8I1w34hfho2_1280.png">
<img src="https://68.media.tumblr.com/1eea370bdf68eabeec685f4609b8660d/tumblr_omo0gfTM8I1w34hfho3_1280.png">
<img src="https://68.media.tumblr.com/65b545b972450f03be3aed4f91fb58ba/tumblr_omo0gfTM8I1w34hfho5_1280.png">
<img src="https://68.media.tumblr.com/8eaaa91a977d9d9f083375f9c25b296d/tumblr_omo0gfTM8I1w34hfho4_1280.png">
<img src="https://68.media.tumblr.com/4452fecce1b47f3eb3785c4634154f71/tumblr_omo0gfTM8I1w34hfho1_1280.png">
</div>
<div class="pdf">
<!-- wireframes-->
<img src="https://68.media.tumblr.com/bd85af7bc33d967c3bc1d2c3a652cb0c/tumblr_omob6m2joz1w34hfho2_1280.png">
<img src="https://68.media.tumblr.com/99379cfa879f8933b324dc19ec1eff40/tumblr_omob6m2joz1w34hfho4_1280.png">
<img src="https://68.media.tumblr.com/b93a861e995036681bca011466728e12/tumblr_omob6m2joz1w34hfho1_1280.png">
<img src="https://68.media.tumblr.com/b65291e59aafa734d45e71afe6577471/tumblr_omob6m2joz1w34hfho3_1280.png">
</div>
<div class="pdf">
<!-- flowchart-->
<img src="https://68.media.tumblr.com/5cf04fbf473771e3ad12bc35c37ef9df/tumblr_omoa1vsBJz1w34hfho1_1280.png" class="background-color-white">
</div>
</div>
</article>
<!--Do - to do list -->
<article>
<div class="thumbnail" id="tn-do">
<div class="textWrapper">
<h2>Do</h2>
<h3>Your interactive planning buddy.</h3>
</div>
<div class="toggleText"></div>
</div>
<div class="content" id="content4">
<p>Test tekst3</p><br>
<video controls>
<source src="https://nadiasportfolio1.tumblr.com/video_file/t:iXG2gnAz8wfzNTNiBot6bQ/158063052645/tumblr_ome2pg5G361w34hfh/480" type="video/mp4">
</video><br>
<embed class="embed-code" src="http://static.tumblr.com/6zouj6x/u8xomeeab/code_week_7.5.txt">
</div>
</article>
<!--Van Gogh museum concept -->
<article>
<div class="thumbnail" id="tn-van-gogh">
<div class="textWrapper">
<h2>Vincent van Gogh</h2>
<h3>Museum concept.</h3>
</div>
<div class="toggleText"></div>
</div>
<div class="content" id="content5">
<p>Test tekst3</p><br>
<img src="https://68.media.tumblr.com/fe28945f60e1d27d89b03f79661b7f1a/tumblr_omo650hbbp1w34hfho1_1280.png"><br>
<img src="https://68.media.tumblr.com/35adcb40d7794ff87a24f6c1137dea18/tumblr_omo650hbbp1w34hfho3_r1_1280.png"><br>
<img src="https://68.media.tumblr.com/1aefc3bee07b76fbc2a77e42ea21987c/tumblr_omo650hbbp1w34hfho2_r1_1280.png">
</div>
</article>
<!--Festival data visualisation -->
<article>
<div class="thumbnail" id="tn-data-visualisation">
<div class="textWrapper">
<h2>Festival fun</h2>
<h3>Data visualisation.</h3>
</div>
<div class="toggleText"></div>
</div>
<div class="content" id="content6">
<p>Test tekst3</p><br>
<img src="http://static.tumblr.com/6zouj6x/ZMgomo9ik/ballonnen.svg"> <br>
<img src="http://static.tumblr.com/6zouj6x/Yonomo9jy/ballonnen_met_mens.svg">
</div>
</article>
<!--nature tour concept -->
<article>
<div class="thumbnail" id="tn-nature-tour">
<div class="textWrapper">
<h2>Nature tour</h2>
<h3>Hybrid reality studying.</h3>
</div>
<div class="toggleText"></div>
</div>
<div class="content" id="content7">
<p>Test tekst3</p><br>
<img src="https://68.media.tumblr.com/7e0c4cc06b662fca87201399ad134d64/tumblr_omocqygQIu1w34hfho1_1280.png"> <br>
<img src="https://68.media.tumblr.com/696f84dadfdbe32a27e465cc32587644/tumblr_omocqygQIu1w34hfho2_1280.png">
</div>
</article>
<!-- Insect stamps -->
<article>
<div class="thumbnail" id="tn-insect-stamps">
<div class="textWrapper">
<h2>Insect stamps</h2>
<h3>Print design.</h3>
</div>
<div class="toggleText"></div>
</div>
<div class="content" id="content8">
<p>Test tekst3</p><br>
<div class="pdf">
<img src="https://68.media.tumblr.com/41d9fb6e284ba7f2b3250c3ab6df237f/tumblr_omt5bdemab1w34hfho1_1280.png">
<img src="https://68.media.tumblr.com/d1353684775c941d446f27cbbcbe2e20/tumblr_omt5bdemab1w34hfho2_1280.jpg">
<img src="https://68.media.tumblr.com/5a7049422a210bfd6662cca2715dec61/tumblr_omt5bdemab1w34hfho3_1280.png">
<img src="https://68.media.tumblr.com/f907bae2cb23340dac25a7fcee2086b7/tumblr_omt5bdemab1w34hfho4_1280.jpg">
<img src="https://68.media.tumblr.com/08c51ac81196e4cf97f07d440b187f97/tumblr_omt5bdemab1w34hfho5_1280.jpg">
<img src="https://68.media.tumblr.com/b723a80f40b6a47b1685cbb211ceffe5/tumblr_omt5bdemab1w34hfho7_1280.png">
<img src="https://68.media.tumblr.com/13e4fecf712f10b17456c13a9f60f9f9/tumblr_omt5bdemab1w34hfho6_1280.png">
<img src="https://68.media.tumblr.com/65c627320107a02f7d611b1cec67cea6/tumblr_omt5bdemab1w34hfho8_1280.png">
<img src="https://68.media.tumblr.com/47785b763eafda7a6efa7debaaf03d06/tumblr_omt5bdemab1w34hfho10_1280.png">
<img src="https://68.media.tumblr.com/a2770b062c2b80146c4101fb85d03194/tumblr_omt5bdemab1w34hfho9_1280.png">
<img src="https://68.media.tumblr.com/53c925ddb870b2e548e8a542799a2a54/tumblr_omt5hkNls91w34hfho1_1280.jpg">
<img src="https://68.media.tumblr.com/182f16489d01d846c55c3a9022b52ddb/tumblr_omt5hkNls91w34hfho2_1280.png">
<img src="https://68.media.tumblr.com/a63baa1ad66ed76657b0a440bc072c18/tumblr_omt5hkNls91w34hfho3_1280.png">
<img src="https://68.media.tumblr.com/18574a0a546a587c946b8d1fbd057acb/tumblr_omt5hkNls91w34hfho4_1280.jpg">
<img src="https://68.media.tumblr.com/1c11c92fdd5d594a10b036eb7e8bac48/tumblr_omt5hkNls91w34hfho5_1280.jpg">
<img src="https://68.media.tumblr.com/c2b54fedf1b2903071aca31beba48dbb/tumblr_omt5hkNls91w34hfho6_1280.png">
<img src="https://68.media.tumblr.com/2f138adcce9e7b9f884797a5e368863d/tumblr_omt5hkNls91w34hfho7_1280.png">
<img src="https://68.media.tumblr.com/80a6230cd93c50508bd99bdc9902eaeb/tumblr_omt5hkNls91w34hfho8_1280.jpg">
<img src="https://68.media.tumblr.com/3c3d875629cd2ced500c9c59c288ca61/tumblr_omt5hkNls91w34hfho9_1280.jpg">
</div>
</div>
</article>
</section>
<footer>
</footer>
</body>
</html>
Related
I'm trying to make an image to open on another location on the page while its been hovered.
I looked online but didn't find a way to do that functionallty usuing only html and css.
Anyone know how to achive that?
Not hovered:
Hovered:
I tried to make another copy of the image transpert on defined area on a grid but it can't sit on top of the text.
html code:
<section id="fav-place" class="place-sec">
<article class="place-art">
<div class="place-desc">
<h1>A place I Enjoyed visiting</h1>
<h2 class="sec-h2">Cape Greco, Cyprus</h2>
<p>Cape Greco is cape and also a small peninsula in the southeast of Cyprus, in Famagusta, between Ayia Napa and Paralimni.
According to the findings of the excavations that took place in 1992, this site is considered to be one of the most ancient settlements on the island
</p>
<p>
In the sea area of Cape Greco there are submarine ravines and caves that are popular for diving.
Within sea ravines up to 10 meters high, there are sea caves, which are called "palaces".
These caves, along with Smugglers caves, are accessible only by the sea.
</p>
</div>
<div class="why-i-like-place">
<h2>Why I like this place</h2>
<p>Because of the clear water, the cliffs around and the beautiful sights</p>
</div>
</article>
<aside class="place-aside">
<img class="p-sm-img first-last-img" src="/images/cape-greco-imgs/boat.jpg" alt="boat-img">
<img class="p-sm-img" src="/images/cape-greco-imgs/bridge.jpg" alt="bridge-img">
<img class="p-sm-img" src="/images/cape-greco-imgs/cave.jpg" alt="cave-img">
<img class="p-sm-img" src="/images/cape-greco-imgs/hole.jpg" alt="hole-img">
<img class="p-sm-img" src="/images/cape-greco-imgs/sm cliff.jpg" alt="sm-cliff-img">
<img class="p-sm-img" src="/images/cape-greco-imgs/sunrise.jpg" alt="sunrise-img">
<img class="p-sm-img first-last-img" src="/images/cape-greco-imgs/tree.jpg" alt="tree-img">
</aside>
</section>
css code:
.place-art {
grid-column: 1/2;
display: grid;
grid-template-rows: 3fr 1fr;
}
.place-desc-sec{
grid-row: 1/-2;
}
.place-aside {
border: solid 0.5vh;
border-color: rgba(185, 218, 100, 0.862);
border-radius: 1vh;
margin-top: 6vh;
overflow-y: scroll;
display: flex;
flex-direction: column;
}
.place-sec {
display: grid;
grid-template-columns: 2fr 1fr;
}
.first-last-img {
margin: 0;
}
.p-sm-img {
margin: 0.2vh 0;
width: 23.5vw;
}
.p-sm-img:hover {
}
.p-lrg-img {
visibility: hidden;
opacity: 0.2;
grid-row: 1/-2;
grid-column: 1/2;
}
.why-i-like-place {
grid-row: 2/3;
grid-column: 1/2
}
Heres the code!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="main.css">
<title>website</title>
</head>
<body>
<section id="fav-place" class="place-sec">
<article class="place-art">
<div class="place-desc">
<h1>A place I Enjoyed visiting</h1>
<h2 class="sec-h2">Cape Greco, Cyprus</h2>
<p>Cape Greco is cape and also a small peninsula in the southeast of Cyprus, in Famagusta, between Ayia Napa and Paralimni.
According to the findings of the excavations that took place in 1992, this site is considered to be one of the most ancient settlements on the island
</p>
<p>
In the sea area of Cape Greco there are submarine ravines and caves that are popular for diving.
Within sea ravines up to 10 meters high, there are sea caves, which are called "palaces".
These caves, along with Smugglers caves, are accessible only by the sea.
</p>
</div>
<div class="why-i-like-place">
<h2>Why I like this place</h2>
<p>Because of the clear water, the cliffs around and the beautiful sights</p>
</div>
</article>
<img id="bigImg">
<aside class="place-aside">
<img onmouseover="" class="p-sm-img first-last-img" src="/images/5f80f09d-6657-41af-a56c-bb2970718dfb.jpg" alt="boat-img">
<img class="p-sm-img" src="/images/adobestock_162537886.jpeg" alt="bridge-img">
<img class="p-sm-img" src="/images/bg6.jpg" alt="cave-img">
<img class="p-sm-img" src="/images/city-buildings-sunset-clouds-wallpaper-preview.jpg" alt="hole-img">
<img class="p-sm-img" src="/images/helianthus-yellow-flower-pixabay_11863.jpg cliff.jpg" alt="sm-cliff-img">
<img class="p-sm-img" src="/images/image_large.jpg" alt="sunrise-img">
<img class="p-sm-img first-last-img" src="/images/photo-1448375240586-882707db888b.jpg" alt="tree-img">
</aside>
</section>
<script src="app.js"></script>
</body>
</html>
.place-art {
grid-column: 1/2;
display: grid;
grid-template-rows: 3fr 1fr;
}
.place-desc-sec{
grid-row: 1/-2;
}
.place-aside {
border: solid 0.5vh;
border-color: rgba(185, 218, 100, 0.862);
border-radius: 1vh;
margin-top: 6vh;
overflow-y: scroll;
display: flex;
flex-direction: column;
}
.place-sec {
display: grid;
grid-template-columns: 2fr 1fr;
}
.first-last-img {
margin: 0;
}
.p-sm-img {
margin: 0.2vh 0;
width: 23.5vw;
}
#bigImg {
max-width: 500px;
position: fixed;
right: 0;
top: 0;
}
.p-lrg-img {
visibility: hidden;
opacity: 0.2;
grid-row: 1/-2;
grid-column: 1/2;
}
.why-i-like-place {
grid-row: 2/3;
grid-column: 1/2
}
a = document.querySelectorAll(".p-sm-img");
for (i in a) {
a[i].onmouseover = function (e) {
document.querySelector("#bigImg").src = this.src;
};
}
I hope open in a lightbox view help you in this case
function openModal() {
document.getElementById("myModal").style.display = "block";
}
function closeModal() {
document.getElementById("myModal").style.display = "none";
}
var slideIndex = 1;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("demo");
var captionText = document.getElementById("caption");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
captionText.innerHTML = dots[slideIndex-1].alt;
}
body {
font-family: Verdana, sans-serif;
margin: 0;
}
* {
box-sizing: border-box;
}
.row > .column {
padding: 0 8px;
}
.row:after {
content: "";
display: table;
clear: both;
}
.column {
float: left;
width: 25%;
}
/* The Modal (background) */
.modal {
display: none;
position: fixed;
z-index: 1;
padding-top: 100px;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: black;
}
/* Modal Content */
.modal-content {
position: relative;
background-color: #fefefe;
margin: auto;
padding: 0;
width: 90%;
max-width: 1200px;
}
/* The Close Button */
.close {
color: white;
position: absolute;
top: 10px;
right: 25px;
font-size: 35px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #999;
text-decoration: none;
cursor: pointer;
}
.mySlides {
display: none;
}
.cursor {
cursor: pointer;
}
/* Next & previous buttons */
.prev,
.next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
padding: 16px;
margin-top: -50px;
color: white;
font-weight: bold;
font-size: 20px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
user-select: none;
-webkit-user-select: none;
}
/* Position the "next button" to the right */
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
/* On hover, add a black background color with a little bit see-through */
.prev:hover,
.next:hover {
background-color: rgba(0, 0, 0, 0.8);
}
/* Number text (1/3 etc) */
.numbertext {
color: #f2f2f2;
font-size: 12px;
padding: 8px 12px;
position: absolute;
top: 0;
}
img {
margin-bottom: -4px;
}
.caption-container {
text-align: center;
background-color: black;
padding: 2px 16px;
color: white;
}
.demo {
opacity: 0.6;
}
.active,
.demo:hover {
opacity: 1;
}
img.hover-shadow {
transition: 0.3s;
}
.hover-shadow:hover {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
<div class="row">
<div class="column">
<img src="https://www.fotoaparat.cz/imgs/a/26/2639/0n1wjdf0-cr-em13-09-1200x627x9.jpg" style="width:100%" onclick="openModal();currentSlide(1)" class="hover-shadow cursor">
</div>
<div class="column">
<img src="https://images.unsplash.com/photo-1579353977828-2a4eab540b9a?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8c2FtcGxlfGVufDB8fDB8fA%3D%3D&w=1000&q=80" style="width:100%" onclick="openModal();currentSlide(2)" class="hover-shadow cursor">
</div>
<div class="row">
<div class="column">
<img src="https://www.fotoaparat.cz/imgs/a/26/2639/0n1wjdf0-cr-em13-09-1200x627x9.jpg" style="width:100%" onclick="openModal();currentSlide(1)" class="hover-shadow cursor">
</div>
<div class="column">
<img src="https://images.unsplash.com/photo-1579353977828-2a4eab540b9a?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8c2FtcGxlfGVufDB8fDB8fA%3D%3D&w=1000&q=80" style="width:100%" onclick="openModal();currentSlide(2)" class="hover-shadow cursor">
</div>
</div>
<div id="myModal" class="modal">
<span class="close cursor" onclick="closeModal()">×</span>
<div class="modal-content">
<div class="mySlides">
<div class="numbertext">1 / 4</div>
<img src="https://www.fotoaparat.cz/imgs/a/26/2639/0n1wjdf0-cr-em13-09-1200x627x9.jpg" style="width:100%">
</div>
<div class="mySlides">
<div class="numbertext">2 / 4</div>
<img src="https://images.unsplash.com/photo-1579353977828-2a4eab540b9a?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8c2FtcGxlfGVufDB8fDB8fA%3D%3D&w=1000&q=80" style="width:100%">
</div>
<div class="mySlides">
<div class="numbertext">3 / 4</div>
<img src="img_mountains_wide.jpg" style="width:100%">
</div>
<div class="mySlides">
<div class="numbertext">4 / 4</div>
<img src="img_lights_wide.jpg" style="width:100%">
</div>
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
<div class="caption-container">
<p id="caption"></p>
</div>
<div class="column">
<img class="demo cursor" src="img_nature_wide.jpg" style="width:100%" onclick="currentSlide(1)" alt="Nature and sunrise">
</div>
<div class="column">
<img class="demo cursor" src="img_snow_wide.jpg" style="width:100%" onclick="currentSlide(2)" alt="Snow">
</div>
<div class="column">
<img class="demo cursor" src="img_mountains_wide.jpg" style="width:100%" onclick="currentSlide(3)" alt="Mountains and fjords">
</div>
<div class="column">
<img class="demo cursor" src="img_lights_wide.jpg" style="width:100%" onclick="currentSlide(4)" alt="Northern Lights">
</div>
</div>
</div>
</div>
I am trying to solve an issue where CSS - overflow-x causes a line to fade in and fade out for a brief second after each h2. This only happens when the webpage is rendered (visited or refreshed).
This doesn't happen on Chrome or Firefox on the computer. It doesn't happen on Safari on Iphone 8 as well.
The following link contain all of the code: https://jsbin.com/liqodaluwo/edit?html,css,output
You don't need overflow-x for your Text elements in this case, because the text Elements won't be cutted, so just use overflow:hidden;
/* Body */
body {
overflow-x: hidden;
font: 16px/1 "Montserrat", Arial, Helvetica, sans-serif;
color: white;
background: #101010;
margin: 0;
padding: 0;
}
/* Global */
li {
list-style: square;
}
.container {
text-align: center;
width: 90%;
margin: auto;
}
/* Gallery */
#gallery,
#gallery-card,
#gallery-music,
#gallery-substance-designer {
font-size: 0;
list-style: none;
outline: none;
margin: 0;
padding: 0;
}
#gallery li,
#gallery-music li,
#gallery-substance-designer li {
display: inline-block;
position: relative;
margin: 2px;
padding: 0;
}
#gallery-card li {
display: inline-block;
position: relative;
margin: 10px;
padding: 0;
}
#gallery a,
#gallery-card a,
#gallery-music a,
#gallery-substance-designer a {
color: white;
text-decoration: none;
outline: none;
}
#gallery img,
#gallery-card img,
#gallery-substance-designer img {
cursor: pointer;
height: auto;
width: 300px;
max-width: 100%;
margin: 0;
padding: 0;
transform: scale(1);
transition: all 0.2s;
}
#gallery img:hover,
#gallery-substance-designer img:hover {
transform: scale(0.98);
}
#gallery iframe,
#gallery-card iframe,
#gallery-music iframe,
#gallery-substance-designer iframe {
max-width: 100%;
margin: 0;
padding: 0;
}
/* Card */
.card {
max-width: 300px;
}
.card-info,
.card-info-center {
font-size: 12px;
background: #202020;
margin: 0;
padding: 15px;
transition: all 0.3s;
}
.card-info {
text-align: left;
}
.card-info h2,
.card-info-center h2 {
margin: 0;
padding: 0;
}
.card-info p,
.card-info-center p {
margin: 0;
padding-top: 10px;
}
.card-price {
font-size: 16px;
margin-top: 20px;
padding: 0;
}
.card-price p {
text-align: right;
margin: 0;
padding: 0;
}
.card:hover .card-info,
.card:hover .card-info-center {
background: #404040;
}
/* Fade In */
.fade-in {
animation: animation-fade-in 1s;
}
#keyframes animation-fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
/* Desktops & Laptops */
#media only screen and (max-width: 1085px) {
#global-container,
#global-content,
#slideshow {
width: auto;
}
#about-profile,
#about-profile-text,
#global-sidebar {
float: none;
width: auto;
}
.details {
width: 100%;
margin: 0 0 20px;
}
.information,
#sys-req {
padding: 1px 10px 5px;
}
#about-divider {
background: linear-gradient(to left, #00000000 0%, #303030 50%, #00000000 100%);
float: none;
width: auto;
height: 1px;
margin: 10px 10% 0;
}
#slideshow-container {
display: block;
}
#slideshow-summary {
text-align: center;
float: none;
width: auto;
margin: 0 0 20px;
}
#slideshow-summary div {
display: inline-block;
vertical-align: top;
text-align: justify;
max-width: 380px;
margin: 0 10px;
}
#slideshow-summary img {
width: 400px;
max-width: 100%;
}
}
/* Tablets & Mobile Phones */
#media only screen and (max-width: 625px) {
/* Hide Navigation */
#navigation {
display: none;
}
/* Show Navigation Icons */
#navigation-icons {
display: block;
}
/* Expand Body to fit all content (Navigation Icons bar would otherwise hide content) */
body {
padding-bottom: 52px;
}
/* Download content resize */
#download-content {
max-width: 100%;
max-height: 100%;
}
.card {
max-width: 150px;
}
.card-info-center h2 {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
<!DOCTYPE html>
<html>
<head>
<!-- Links -->
<link rel="stylesheet" href="/css/main.css">
<link rel="shortcut icon" type="image/x-icon" href="/img/global/favicon.ico">
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat&display=auto">
<!-- Title -->
<title>tet</title>
</head>
<body>
<!-- Main Content -->
<main class="container">
<section>
<h1>test</h1>
<!-- Portfolio -->
<ul id="gallery-card">
<li>
<article class="card">
<a href="/portfolio/games">
<img class="lazyload" src="/img/global/lazyload/card.png" data-src="/img/portfolio/t-games.png">
<div class="card-info-center">
<h2>Games aw w dwadaw</h2>
</div>
</a>
</article>
</li>
<li>
<article class="card">
<a href="/portfolio/2d-art">
<img class="lazyload" src="/img/global/lazyload/card.png" data-src="/img/portfolio/t-2d-art.png">
<div class="card-info-center">
<h2>2D Art</h2>
</div>
</a>
</article>
</li>
<li>
<article class="card">
<a href="/portfolio/3d-models">
<img class="lazyload" src="/img/global/lazyload/card.png" data-src="/img/portfolio/t-3d-models.png">
<div class="card-info-center">
<h2>3D Models</h2>
</div>
</a>
</article>
</li>
<li>
<article class="card">
<a href="/portfolio/particles/page-1">
<img class="lazyload" src="/img/global/lazyload/card.png" data-src="/img/portfolio/t-particles.png">
<div class="card-info-center">
<h2>Particles</h2>
</div>
</a>
</article>
</li>
<li>
<article class="card">
<a href="/portfolio/shaders/page-1">
<img class="lazyload" src="/img/global/lazyload/card.png" data-src="/img/portfolio/t-shaders.png">
<div class="card-info-center">
<h2>Shaders</h2>
</div>
</a>
</article>
</li>
<li>
<article class="card">
<a href="/portfolio/environments/page-1">
<img class="lazyload" src="/img/global/lazyload/card.png" data-src="/img/portfolio/t-environments.png">
<div class="card-info-center">
<h2>Environments</h2>
</div>
</a>
</article>
</li>
<li>
<article class="card">
<a href="/portfolio/programming/page-1">
<img class="lazyload" src="/img/global/lazyload/card.png" data-src="/img/portfolio/t-programming.png">
<div class="card-info-center">
<h2>Programming</h2>
</div>
</a>
</article>
</li>
<li>
<article class="card">
<a href="/portfolio/substance-designer/page-1">
<img class="lazyload" src="/img/global/lazyload/card.png" data-src="/img/portfolio/t-substance-designer.png">
<div class="card-info-center">
<h2>Substance Designer</h2>
</div>
</a>
</article>
</li>
<li>
<article class="card">
<a href="/portfolio/music">
<img class="lazyload" src="/img/global/lazyload/card.png" data-src="/img/portfolio/t-music.png">
<div class="card-info-center">
<h2>Music</h2>
</div>
</a>
</article>
</li>
</ul>
</section>
</main>
<!-- Scripts -->
<script src="/js/lazyload.js"></script>
</body>
</html>
I'm using Swiper to create some image sliders, and I'm trying to enclose the sliders within 2 flexbox containers such that my images are responsive.
I'd like to add some text on top of the images, aligned with the upper left corner of the image, and this is where everything goes wrong.
I believe I'm dealing with Flexbox "problem" very similar to Why don't flex items shrink past content size? in which case the parent DIV is keeping the width of the original image. The problem is the fixes in the post don't appear to work once I wrap the image in <div class="img-wrapper">. In fact I've spent quite a bit of time researching, and nothing quite seems to get it working the way I want.
This question is a fork of CSS object-fit: contain; is keeping original image width in layout
NOTE: Open the below code snippet in a new window to see the issue.
var swiper = new Swiper('.swiper-container', {
slidesPerView: 1,
spaceBetween: 50,
// init: false,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
});
img {
object-fit: contain;
min-width: 0;
height: 100%;
max-width: 100%;
}
.img-num {
float: left;
position: absolute;
padding-left: 10px;
text-shadow: 1px 1px 2px black, 0 0 1em blue, 0 0 0.2em blue;
color: white;
font: 1.5em Georgia, serif;
}
.img-wrapper {
border-style: solid;
border-width: thin;
height: 100%;
object-fit: contain;
min-width: 0;
}
html,
body {
margin: 0;
height: 100%;
}
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0;
padding: 0;
}
.page {
height: 100%;
display: flex;
}
.main-container {
flex: 1 1 0;
display: flex;
min-width: 0;
flex-direction: column;
}
.half-containers {
flex: 0 1 50%;
overflow: auto;
box-sizing: border-box;
border: 0.5px solid red;
display: flex;
}
.page-header {
flex: 0 0 auto;
background-color: #dcdcdc;
}
.page-footer {
flex: 0 0 auto;
background-color: #dcdcdc;
}
.swiper-container {
width: 100%;
height: 100%;
}
.swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
/* Center slide text vertically */
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.4.6/css/swiper.css" rel="stylesheet" />
<div class="page">
<div class="main-container">
<div class="page-header">
This is a header
</div>
<div class="half-containers">
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">1</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">2</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
</div>
</div>
</div>
<div class="half-containers">
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">3</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">4</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
</div>
</div>
</div>
<div class="page-footer">
This is a footer
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.4.6/js/swiper.js"></script>
First, the use of object-fit is useless when applied to a div and not to the image1. Even the use of it within the image in this case is useless because the image is not getting distorted. object-fit only apply when the ratio is lost in order to bring it back again.
So you will have the same issue without:
var swiper = new Swiper('.swiper-container', {
slidesPerView: 1,
spaceBetween: 50,
// init: false,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
});
img {
height: 100%;
max-width: 100%;
}
.img-num {
float: left;
position: absolute;
padding-left: 10px;
text-shadow: 1px 1px 2px black, 0 0 1em blue, 0 0 0.2em blue;
color: white;
font: 1.5em Georgia, serif;
}
.img-wrapper {
border-style: solid;
border-width: thin;
height: 100%;
}
html,
body {
margin: 0;
height: 100%;
}
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0;
padding: 0;
}
.page {
height: 100%;
display: flex;
}
.main-container {
flex: 1 1 0;
display: flex;
min-width: 0;
flex-direction: column;
}
.half-containers {
flex: 0 1 50%;
overflow: auto;
box-sizing: border-box;
border: 0.5px solid red;
display: flex;
}
.page-header {
flex: 0 0 auto;
background-color: #dcdcdc;
}
.page-footer {
flex: 0 0 auto;
background-color: #dcdcdc;
}
.swiper-container {
width: 100%;
height: 100%;
}
.swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
/* Center slide text vertically */
display: flex;
justify-content: center;
align-items: center;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.4.6/css/swiper.css" rel="stylesheet" />
<div class="page">
<div class="main-container">
<div class="page-header">
This is a header
</div>
<div class="half-containers">
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">1</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">2</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
</div>
</div>
</div>
<div class="half-containers">
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">3</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">4</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
</div>
</div>
</div>
<div class="page-footer">
This is a footer
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.4.6/js/swiper.js"></script>
Now the issue you are facing is that the image wrapper is first sized considerd the image width then the image is getting resized inside that wrapper. It's somehow complex but if you remove height:100% from the image you will have this:
var swiper = new Swiper('.swiper-container', {
slidesPerView: 1,
spaceBetween: 50,
// init: false,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
});
img {
/*height: 100%;*/
max-width: 100%;
}
.img-num {
float: left;
position: absolute;
padding-left: 10px;
text-shadow: 1px 1px 2px black, 0 0 1em blue, 0 0 0.2em blue;
color: white;
font: 1.5em Georgia, serif;
}
.img-wrapper {
border-style: solid;
border-width: thin;
height: 100%;
}
html,
body {
margin: 0;
height: 100%;
}
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0;
padding: 0;
}
.page {
height: 100%;
display: flex;
}
.main-container {
flex: 1 1 0;
display: flex;
min-width: 0;
flex-direction: column;
}
.half-containers {
flex: 0 1 50%;
overflow: auto;
box-sizing: border-box;
border: 0.5px solid red;
display: flex;
}
.page-header {
flex: 0 0 auto;
background-color: #dcdcdc;
}
.page-footer {
flex: 0 0 auto;
background-color: #dcdcdc;
}
.swiper-container {
width: 100%;
height: 100%;
}
.swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
/* Center slide text vertically */
display: flex;
justify-content: center;
align-items: center;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.4.6/css/swiper.css" rel="stylesheet" />
<div class="page">
<div class="main-container">
<div class="page-header">
This is a header
</div>
<div class="half-containers">
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">1</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">2</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
</div>
</div>
</div>
<div class="half-containers">
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">3</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">4</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
</div>
</div>
</div>
<div class="page-footer">
This is a footer
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.4.6/js/swiper.js"></script>
This is actually what you want considering the width but the height is big thus the image is overflowing. By adding height:100% you will decrease the height and also the width because the image will try to keep its ratio. Of course, the wrapper will not get resized again because will have a cycle thus it will stuck at that size.
An easy fix is to simply make the image wrapper position: absolute;. its height is already defined as 100% and its width will shrink to fit the image width. No need to adjust top/left because it's already centred without the use of absolute thus it will be kept centred:
var swiper = new Swiper('.swiper-container', {
slidesPerView: 1,
spaceBetween: 50,
// init: false,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
});
img {
height: 100%;
max-width: 100%;
}
.img-num {
top:0;
left:0;
position: absolute;
padding-left: 10px;
text-shadow: 1px 1px 2px black, 0 0 1em blue, 0 0 0.2em blue;
color: white;
font: 1.5em Georgia, serif;
}
.img-wrapper {
border-style: solid;
border-width: thin;
height: 100%;
position: absolute;
}
html,
body {
margin: 0;
height: 100%;
}
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0;
padding: 0;
}
.page {
height: 100%;
display: flex;
}
.main-container {
flex: 1 1 0;
display: flex;
min-width: 0;
flex-direction: column;
}
.half-containers {
flex: 0 1 50%;
overflow: auto;
box-sizing: border-box;
border: 0.5px solid red;
display: flex;
}
.page-header {
flex: 0 0 auto;
background-color: #dcdcdc;
}
.page-footer {
flex: 0 0 auto;
background-color: #dcdcdc;
}
.swiper-container {
width: 100%;
height: 100%;
}
.swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
/* Center slide text vertically */
display: flex;
justify-content: center;
align-items: center;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.4.6/css/swiper.css" rel="stylesheet" />
<div class="page">
<div class="main-container">
<div class="page-header">
This is a header
</div>
<div class="half-containers">
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">1</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">2</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
</div>
</div>
</div>
<div class="half-containers">
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">3</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">4</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
</div>
</div>
</div>
<div class="page-footer">
This is a footer
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.4.6/js/swiper.js"></script>
1The object-fit property specifies how the contents of a replaced element should be fitted to the box established by its used height and width.ref
A div is not a replaced element. Replaced elements are element like canvas, img, iframe, etc (https://html.spec.whatwg.org/multipage/rendering.html#replaced-elements)
UPDATE
The above seems to work only on Chrome so I would consider a small JS hack to rectify the width of the element on the other browsers:
var swiper = new Swiper('.swiper-container', {
slidesPerView: 1,
spaceBetween: 50,
// init: false,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
});
$('.img-wrapper').each(function() {
$(this).width($(this).find('img').width())
})
$( window ).resize(function() {
$('.img-wrapper').each(function() {
$(this).css('width','100%').width($(this).find('img').width())
})
});
img {
height: 100%;
max-width: 100%;
object-fit:cover;
}
.img-num {
top:0;
left:0;
position: absolute;
padding-left: 10px;
text-shadow: 1px 1px 2px black, 0 0 1em blue, 0 0 0.2em blue;
color: white;
font: 1.5em Georgia, serif;
}
.img-wrapper {
border-style: solid;
border-width: thin;
height: 100%;
position: absolute;
max-width:100%;
}
html,
body {
margin: 0;
height: 100%;
}
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0;
padding: 0;
}
.page {
height: 100%;
display: flex;
}
.main-container {
flex: 1 1 0;
display: flex;
min-width: 0;
flex-direction: column;
}
.half-containers {
flex: 0 1 50%;
overflow: auto;
box-sizing: border-box;
border: 0.5px solid red;
display: flex;
}
.page-header {
flex: 0 0 auto;
background-color: #dcdcdc;
}
.page-footer {
flex: 0 0 auto;
background-color: #dcdcdc;
}
.swiper-container {
width: 100%;
height: 100%;
}
.swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
/* Center slide text vertically */
display: flex;
justify-content: center;
align-items: center;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.4.6/css/swiper.css" rel="stylesheet" />
<div class="page">
<div class="main-container">
<div class="page-header">
This is a header
</div>
<div class="half-containers">
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">1</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">2</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
</div>
</div>
</div>
<div class="half-containers">
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">3</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
<div class="swiper-slide">
<div class="img-wrapper">
<div class="img-num">4</div>
<img src='https://i.imgur.com/mSPw98T.jpg' />
</div>
</div>
</div>
</div>
</div>
<div class="page-footer">
This is a footer
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.4.6/js/swiper.js"></script>
I am working with bootstrap 4. I have added a row with the class name sponsor-slider-row, also giving bootstrap call called container-fluid but nothing happen to like my row did not take the full width.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div class="sponsor-slider-row container-fluid">
<div class="row">
<div class="col-sm-12">
<section class="section-sponsor-slider">
<h2 class="section-header">Sponsor Slider</h2>
<div class="autoplay slider">
<div>
<img src="https://via.placeholder.com/150">
</div>
<div>
<img src="https://via.placeholder.com/150">
</div>
<div>
<img src="https://via.placeholder.com/150">
</div>
<div>
<img src="https://via.placeholder.com/150">
</div>
<div>
<img src="https://via.placeholder.com/150">
</div>
<div>
<img src="https://via.placeholder.com/150">
</div>
</div>
</section>
</div>
</div>
</div>
You do indeed have full width but your image is not sized to that, it is 150X150. I added some garish borders to show this.
Note here I force a width on the images in the second group.
.testme {
border: solid 4px lime;
}
.myimgc,
.myimgc2 {
border: solid 4px red;
}
.myimgc img,
.myimgc2 img {
border: solid 4px cyan;
}
.myimgc img {
width: 100%;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div class="col-sm-12 sponsor-slider-row container-fluid">
<div class="row">
<div class="col-sm-12 testme">
<section class="section-sponsor-slider">
<h2 class="section-header">Sponsor Slider</h2>
<div class="autoplay slider">
<div class="myimgc2">
<img src="https://via.placeholder.com/150">
</div>
<div class="myimgc2">
<img src="https://via.placeholder.com/150">
</div>
<div class="myimgc2">
<img src="https://via.placeholder.com/150">
</div>
<div class="myimgc2">
<img src="https://via.placeholder.com/150">
</div>
<div class="myimgc2">
<img src="https://via.placeholder.com/150">
</div>
<div class="myimgc2">
<img src="https://via.placeholder.com/150">
</div>
</div>
</section>
</div>
</div>
</div>
<div class="col-sm-12 sponsor-slider-row container-fluid">
<div class="row">
<div class="col-sm-12 testme">
<section class="section-sponsor-slider">
<h2 class="section-header">Sponsor Slider</h2>
<div class="autoplay slider">
<div class="myimgc">
<img src="https://via.placeholder.com/150">
</div>
<div class="myimgc">
<img src="https://via.placeholder.com/150">
</div>
<div class="myimgc">
<img src="https://via.placeholder.com/150">
</div>
<div class="myimgc">
<img src="https://via.placeholder.com/150">
</div>
<div class="myimgc">
<img src="https://via.placeholder.com/150">
</div>
<div class="myimgc">
<img src="https://via.placeholder.com/150">
</div>
</div>
</section>
</div>
</div>
</div>
HTML:
body {
max-width: 1200px;
margin: 0 auto;
background: url(../images/bg-pattern.png) repeat 50% 0
}
.section-header {
position: absolute;
left: -999.9rem
}
.site-header {
position: relative;
z-index: 3;
text-align: center
}
.site-header>div {
position: relative;
max-width: 1200px;
margin: 0 auto
}
.site-header .site-title {
margin: 0;
padding: 0.5rem 0;
text-transform: uppercase
}
.site-header .site-title a {
display: block;
width: 30.6rem;
height: 6rem;
text-indent: -999.9rem;
background: url(../images/advico-logo.png) no-repeat 0 0
}
.site-header .social-links {
position: absolute;
right: 1rem;
top: 2.5rem
}
.site-header .social-links a {
display: inline-block;
width: 2rem;
font-size: 20px;
padding: 7px;
line-height: 1;
text-decoration: none;
color: #000;
transition: 0.3s
}
.site-header .social-links a:hover {
color: #fff;
-webkit-transform: rotate(360deg);
transform: rotate(360deg)
}
.site-header .fa-facebook {
border-radius: 100%;
color: #fff
}
.site-header .fa-facebook:hover {
background: #3b5998
}
.site-header .fa-twitter {
border-radius: 100%;
color: #fff
}
.site-header .fa-twitter:hover {
background: #55acee
}
.dropnav {
font-family: "montserrat", arial
}
.dropnav .navbar:before {
content: '';
position: absolute;
left: -9999px;
right: -9999px;
top: 0;
bottom: 0;
display: block;
background: #1a3364
}
.dropnav .navbar-brand {
display: none
}
.dropnav .navbar-nav .nav-item a {
position: relative;
padding: 0 1.5rem;
font-size: 1rem;
font-weight: 700;
color: #fff
}
.dropnav .navbar-nav .nav-item a:hover {
color: #ccc
}
.dropnav .navbar-nav .nav-item.active a {
color: #fff
}
.dropnav .navbar-toggler {
z-index: 4;
color: #d4882b;
background: #d68224
}
.dropnav .form-control,
.dropnav .btn-outline-success {
display: none
}
.section-carousel .carousel-inner .carousel-item .carousel-caption {
position: absolute;
left: 0;
right: 0;
bottom: 0;
display: block;
background: rgba(0, 0, 0, 0.5)
}
.section-carousel .carousel-inner .carousel-control .prev,
.section-carousel .carousel-inner .carousel-control .next {
color: #000
}
.landing-row.carousel-row .carousel-inner {
display: block;
text-align: center;
margin: 0 auto
}
.landing-row.carousel-row .carousel-inner .carousel-item {
max-height: 40rem
}
.landing-row.carousel-row .carousel-inner .carousel-item img {
width: 100%
}
.landing-row.main-matter-row {
padding: 3rem 0.5rem;
background: #eee
}
.sponsor-slider-row {
padding: 30px 0;
background: #db8323
}
.section-main-matter .section-header {
position: static;
font-size: 1.8rem;
font-family: 'montserrat', arial;
font-weight: 700;
text-transform: uppercase;
color: #000
}
.section-main-matter .company-intro {
font-family: 'montserrat', arial;
font-size: 0.9rem;
font-weight: 200
}
.section-advertisement .map-sq-banner {
text-align: center
}
.section-advertisement .map-sq-banner img {
display: block;
width: 100%
}
.site-footer {
height: 100px;
font-family: "montserrat", arial;
text-align: center;
background: #1a3364
}
.site-footer>div {
max-width: 1200px;
margin: 0 auto
}
.site-footer .footer-text {
padding: 40px 0 0;
font-size: 14px;
font-weight: 700;
color: #fff
}
.site-footer .footer-text span {
display: block;
font-size: 14px;
font-weight: 200
}
.section-sponsor-slider {
display: block;
text-align: center;
margin: 0 auto;
padding: 0
}
.section-sponsor-slider .slick-slide img {
display: block;
width: 100%;
padding: 0 10px;
box-sizing: border-box
}
.section-sponsor-slider .slick-next {
color: #000
}
<head>
<title>Responsive Athletic</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- CUSTOM CSS -->
<link rel="stylesheet" href="css/styles.css?">
<!-- Add icon library -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css" rel="stylesheet" />
</head>
<div class="body-container">
<body>
<div class="sponsor-slider-row container-fluid">
<div class="row">
<div class="col-sm-12">
<section class="section-sponsor-slider">
<h2 class="section-header">Sponsor Slider</h2>
<div class="autoplay slider">
<div>
<img src="images/sponsor-btn.png">
</div>
<div>
<img src="images/sponsor-btn.png">
</div>
<div>
<img src="images/sponsor-btn.png">
</div>
<div>
<img src="images/sponsor-btn.png">
</div>
<div>
<img src="images/sponsor-btn.png">
</div>
<div>
<img src="images/sponsor-btn.png">
</div>
</div>
</section>
</div>
</div>
</div>
<script type="text/javascript">
$('.autoplay').slick({
slidesToShow: 4,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 2000,
});
</script>
</body>
I have absolutely no idea at this point. I have done everything I could to make sure the arrows and the thumbnail images are centered but somehow, it will not budge... I have even tried the but doesn't seem to make an affect. There is an JS file too but I don't think that really matters so I am not posting on here.
.gallery-outer {
overflow: hidden;
width: 830px;
/*left: 18px;
padding: 0 0 0 5px;*/
height: 250px;
margin-left: -50%;
float: left;
}
.gallery-inner {
float: left;
height: 140px;
position: relative;
width: 3390px;
}
.gallery-tmb {
float: left;
margin: 0 10px 0 0;
}
#gallery {
border-left: 1px solid #E9E9E9;
border-right: 1px solid #E9E9E9;
height: 80px;
margin: 15px;
padding: 0;
position: relative;
width: 400px;
}
#arrow-left {
background:#d1d1d1;
cursor: pointer;
height: 82px;
position: absolute;
left: -7px;
top: 0px;
width: 25px;
}
#arrow-left-small {
padding: 10px;
box-shadow: 4px -4px 0 1px black;
position: relative;
display: inline-block;
margin: 40px;
transform: rotate(225deg);
right: 27px;
top:-9px;
}
#arrow-right {
background:#d1d1d1;
cursor: pointer;
height: 82px;
position: absolute;
right: -476px;
top: 0px;
width: 25px;
}
#arrow-right-small {
padding: 10px;
box-shadow: 4px -4px 0 1px black;
position: relative;
display: inline-block;
margin: 40px;
transform: rotate(45deg);
right: 49px;
top:-9px;
}
<div id="gallery">
<div id="arrow-left">
<div id="arrow-left-small">
</div>
</div>
<div class="gallery-outer">
<div class="gallery-inner">
<div class="gallery-tmb">
<img src="images/executive1.png" alt="Executive1" height="auto" width="250"/>
</div>
<div class="gallery-tmb">
<img src="images/executive2.png" alt="Executive2" height="auto" width="250"/>
</div>
<div class="gallery-tmb">
<img src="images/executive3.png" alt="Executive3" height="auto" width="250"/>
</div>
<div class="gallery-tmb">
<img src="images/executive4.png" alt="Executive4" height="auto" width="250"/>
</div>
<div class="gallery-tmb">
<img src="images/executive5.png" alt="Executive5" height="auto" width="250"/>
</div>
<div class="gallery-tmb">
<img src="images/executive6.png" alt="Executive6" height="auto" width="250"/>
</div>
<div class="gallery-tmb">
<img src="images/executive7.png" alt="Executive7" height="auto" width="250"/>
</div>
</div>
</div>
<div id="arrow-right">
<div id="arrow-right-small">
</div>
</div>
</div>
(function ($) {
$.fn.thumbGallery = function (settings) {
var $this = $(this);
return this.each(function () {
settings = jQuery.extend({
speed: 800,
leftArrow: $this.find('#arrow-left'),
rightArrow: $this.find('#arrow-right'),
galleryContainer: $this.find('.gallery-inner'),
visibleImagesSize: 4
}, settings);
var imgElements = settings.galleryContainer.find('img').length;
var size = settings.visibleImagesSize;
settings.leftArrow.hide();
if (imgElements > settings.visibleImagesSize) {
settings.rightArrow.show();
} else {
settings.rightArrow.hide();
}
function animateLeft() {
var el = settings.galleryContainer.children(":last");
settings.galleryContainer.animate({
left: '+=' + el.outerWidth(true) + 'px'
},
settings.speed);
}
function animateRight() {
var el = settings.galleryContainer.children(":first");
settings.galleryContainer.animate({
left: '-=' + el.outerWidth(true) + 'px'
},
settings.speed);
}
function checkArrows() {
if (size === settings.visibleImagesSize) {
settings.leftArrow.hide();
} else {
settings.leftArrow.show();
}
if (size === imgElements) {
settings.rightArrow.hide();
} else {
settings.rightArrow.show();
}
}
settings.leftArrow.click(function () {
animateLeft();
size--;
checkArrows();
});
settings.rightArrow.click(function () {
animateRight();
size++;
checkArrows();
});
});
};
})(jQuery);
$(document).ready(function () {
$('#gallery').thumbGallery();
});
Solution with use of flexbox.
.gallery-outer {
overflow: hidden;
width: 830px;
/*left: 18px;
padding: 0 0 0 5px;*/
height: 250px;
}
.gallery-inner {
float: left;
height: 100%;
position: relative;
width: 3390px;
}
.gallery-tmb {
float: left;
margin: 0 10px 0 0;
}
#gallery {
border-left: 1px solid #E9E9E9;
border-right: 1px solid #E9E9E9;
display: flex;
justify-content: space-between;
margin: 15px;
padding: 0;
position: relative;
width: 800px;
}
#arrow-left {
background:#d1d1d1;
cursor: pointer;
height: 82px;
width: 25px;
align-self: center;
}
#arrow-left-small {
padding: 10px;
box-shadow: 4px -4px 0 1px black;
position: relative;
display: inline-block;
margin: 40px;
transform: rotate(225deg);
right: 27px;
top:-9px;
}
#arrow-right {
background:#d1d1d1;
cursor: pointer;
height: 82px;
width: 25px;
align-self: center;
}
#arrow-right-small {
padding: 10px;
box-shadow: 4px -4px 0 1px black;
position: relative;
display: inline-block;
margin: 40px;
transform: rotate(45deg);
right: 49px;
top:-9px;
}
Flexbox solution
I just built you an example with all the basics.
I don't recommend float abuse, only use it when really needed.
// HOPE IT HELPS
.gallery{
max-width: 600px;
margin: 0 auto;
text-align: center; /* this will center all the inline and inline-block content */
background: purple;
}
.arrow-left,.arrow-right{
width: 100px;
height: 100px;
display: inline-block;
vertical-align: middle;
background: blue;
color: white;
font-size: 5rem; /* just to make arrows show */
}
/* this is just to make the arrows show :p */
.arrow-left:before{
content: '←';
}
.arrow-right:after{
content: '→';
}
/* i'm just between the arrows and also inline (inline-block)*/
.gallery ul{
vertical-align: middle;
background: green;
margin: 0;
padding: 0;
display: inline-block;
}
/* where the images will go (you can use divs instead of ul, li) */
.gallery li {
display: inline-block;
}
img {
background: red;
width: 100px;
height:100px;
}
<div class="gallery">
<div class="arrow-left"></div>
<ul>
<li><img src="#" width=100 height=100 /></li>
<li><img src="#" width=100 height=100 /></li>
<li><img src="#" width=100 height=100 /></li>
</ul>
<div class="arrow-right">
</div>
</div>
You can use a bootstrap template like this:
<!DOCTYPE html>
<html lang="en">
<head>
<style>
.thumbnail{
height: 200px;
}
</style>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<div class="container-fulid">
<div class="row">
<div class="col-md-2 text-right">
<span class="glyphicon glyphicon-chevron-left" style="margin-top:20%"></span>
</div>
<div class="col-md-2">
<div class="thumbnail">
</div>
</div>
<div class="col-md-2">
<div class="thumbnail">
</div>
</div>
<div class="col-md-2">
<div class="thumbnail">
</div>
</div>
<div class="col-md-2">
<div class="thumbnail">
</div>
</div>
<div class="col-md-2 text-left">
<span class="glyphicon glyphicon-chevron-right" style="margin-top:20%"></span>
</div>
</div>
</div>
</div>
</body>
</html>