I'm making a section of the website where there are 3 centered items on the top row and two centered items on the bottom row. I want them aligned like the stars on the American flag.
body {
background-color: #eee;
}
/* ----------------------------- FLIP CIRCLES ----------------------------- */
/* entire container, keeps perspective */
.flip-container {
perspective: 1000px;
}
/* flip the pane when hovered */
.flip-container:hover .flipper {
transform: rotateY(180deg);
}
.flip-container,
.flipping-front,
.flipping-back {
width: 300px;
height: 300px;
display: inline-block;
}
/* flip speed goes here */
.flipper {
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}
/* hide back of pane during swap */
.flipping-front,
.flipping-back {
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
}
/* front pane, placed above back */
.flipping-front {
z-index: 2;
transform: rotateY(0deg);
/* for firefox 31 */
}
/* back, initially hidden pane */
.flipping-back {
transform: rotateY(180deg);
}
.flipper img {
-webkit-border-radius: 100%;
-moz-border-radius: 100%;
border-radius: 100%;
}
<!-- START FLIP BLOCK -->
<div style="margin: auto; display: flex">
<div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
<div class="flipper">
<div class="flipping-front">
<!-- front content -->
<img src="img/flip/front.jpg" width="300" />
</div>
<div class="flipping-back">
<!-- back content -->
<img src="img/flip/back.png" width="300" />
</div>
</div>
</div>
<div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
<div class="flipper">
<div class="flipping-front">
<!-- front content -->
<img src="img/flip/front.jpg" width="300" />
</div>
<div class="flipping-back">
<!-- back content -->
<img src="img/flip/back.png" width="300" />
</div>
</div>
</div>
<div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
<div class="flipper">
<div class="flipping-front">
<!-- front content -->
<img src="img/flip/front.jpg" width="300" />
</div>
<div class="flipping-back">
<!-- back content -->
<img src="img/flip/back.png" width="300" />
</div>
</div>
</div>
</div>
<!-- START FLIP BLOCK: ROW 2 -->
<div style="margin: auto; display: flex">
<div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
<div class="flipper">
<div class="flipping-front">
<!-- front content -->
<img src="img/flip/front.jpg" width="300" />
</div>
<div class="flipping-back">
<!-- back content -->
<img src="img/flip/back.png" width="300" />
</div>
</div>
</div>
<div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
<div class="flipper">
<div class="flipping-front">
<!-- front content -->
<img src="img/flip/front.jpg" width="300" />
</div>
<div class="flipping-back">
<!-- back content -->
<img src="img/flip/back.png" width="300" />
</div>
</div>
</div>
</div>
Related
I am trying to create a simple image grid and I would like to add hover effects to each image. I would like the effect to be a transition to a different image. so far I have the image grid worked out properly but when it comes to adding a hover effect its either effecting my entire column by making images disappear or the image I am using for the transition covers the entire grid. Any help with this would be greatly appreciated.
Here's the code that I've been working with so far
* {
box-sizing: border-box;
}
.row {
display: -ms-flexbox; /* IE10 */
display: flex;
-ms-flex-wrap: wrap; /* IE10 */
flex-wrap: wrap;
padding: 0 4px;
}
/* Create four equal columns that sits next to each other */
.column {
-ms-flex: 20%; /* IE10 */
flex: 20%;
max-width: 20%;
padding: 0 4px;
}
.column img {
margin-top: 8px;
vertical-align: middle;
width: 100%;
}
.image {
display: block;
width: 100%;
height: auto;
}
/* Responsive layout - makes a two column-layout instead of four columns */
#media screen and (max-width: 800px) {
.column {
-ms-flex: 50%;
flex: 50%;
max-width: 50%;
}
}
/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */
#media screen and (max-width: 600px) {
.column {
-ms-flex: 100%;
flex: 100%;
max-width: 100%;
}
}
<!-- Header -->
<div class="header">
</div>
<!-- Photo Grid -->
<div class="row">
<div class="column">
<img src="https://drive.google.com/thumbnail?id=1BiM6pgdVUC8H7A-pO9YMD74jwcvh8uKw" style="width:100%">
<img src="https://drive.google.com/thumbnail?id=1TBfdXETiX00bNkSxTkeePnAJb_TE8KMz" style="width:100%">
<img src="https://drive.google.com/thumbnail?id=1jN0LLKTg7H1j0PQ1estEOSgbxN8IaUhX" style="width:100%">
</div>
<div class="column">
<img src="https://drive.google.com/thumbnail?id=1XI0X_JIsOrpR6AjKxFR2MHdu7KqmbKDf" style="width:100%">
<img src="https://drive.google.com/thumbnail?id=1iSMUDDa3_NQF3FaDw_L0J3b6EypDUlRn" style="width:100%">
<img src="https://drive.google.com/thumbnail?id=1HUhl-gkKjZO2APycCl0Z5Bhm_EWcNoWo" style="width:100%">
</div>
<div class="column">
<img src="https://drive.google.com/thumbnail?id=1-g11eGfBGMtng5eW7MSBTmVjGEc7X3KT" style="width:100%">
<img src="https://drive.google.com/thumbnail?id=1GIssifV2o9YbcM-b_LDe0AwkBqb7WHkE" style="width:100%">
<img src="https://drive.google.com/thumbnail?id=1vdVGVohUrDrkjoOHAi2QFwLDFypdkRR8" style="width:100%">
</div>
<div class="column">
<img src="https://drive.google.com/thumbnail?id=1veQWJj6J3_NW48y4-_cTr2PeO9mhcktm" style="width:100%">
<img src="https://drive.google.com/thumbnail?id=1OFAR6Dh3vMJ7DQnkm4TVky3iBDada5iY" style="width:100%">
<img src="https://drive.google.com/thumbnail?id=1XRwvxsxI8N32HT-XETAxt82j6EA30jF2" style="width:100%">
</div>
<div class="column">
<img src="https://drive.google.com/thumbnail?id=1J1ctFtgHtd0G5gddcZzsSuM-eUpiWsOQ" style="width:100%">
<img src="https://drive.google.com/thumbnail?id=1-oD6Rc5q5Xzq6Qt-FJdfh7pMZo165m3Z" style="width:100%">
<img src="https://drive.google.com/thumbnail?id=1I-zlWhtolgyH_Ewr3F239maUizVjtJRM" style="width:100%">
</div>
</div>
The CSS transition property will help you to achieve this.
You can also use CSS grid for creating the Grid Layout
Checkout the sample code.
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
grid-gap: 1rem;
justify-content: center;
}
.cell {
width: auto;
height: 220px;
overflow: hidden;
position: relative;
display: flex;
}
.content {
width: 100%;
height:100%;
position: absolute;
top: 0px;
left: 0px;
opacity: 1;
transition: 0.5s ease;
}
.cell .content:last-child:hover {
opacity: 0;
}
.content>img{
width:100%;
}
<div class="grid">
<div class="cell">
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1BiM6pgdVUC8H7A-pO9YMD74jwcvh8uKw" />
</div>
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1TBfdXETiX00bNkSxTkeePnAJb_TE8KMz" />
</div>
</div>
<div class="cell">
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1jN0LLKTg7H1j0PQ1estEOSgbxN8IaUhX" />
</div>
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1XI0X_JIsOrpR6AjKxFR2MHdu7KqmbKDf" />
</div>
</div>
<div class="cell">
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1iSMUDDa3_NQF3FaDw_L0J3b6EypDUlRn" />
</div>
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1HUhl-gkKjZO2APycCl0Z5Bhm_EWcNoWo" />
</div>
</div>
<div class="cell">
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1-g11eGfBGMtng5eW7MSBTmVjGEc7X3KT" />
</div>
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1GIssifV2o9YbcM-b_LDe0AwkBqb7WHkE" />
</div>
</div>
<div class="cell">
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1BiM6pgdVUC8H7A-pO9YMD74jwcvh8uKw" />
</div>
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1TBfdXETiX00bNkSxTkeePnAJb_TE8KMz" />
</div>
</div>
<div class="cell">
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1jN0LLKTg7H1j0PQ1estEOSgbxN8IaUhX" />
</div>
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1XI0X_JIsOrpR6AjKxFR2MHdu7KqmbKDf" />
</div>
</div>
<div class="cell">
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1iSMUDDa3_NQF3FaDw_L0J3b6EypDUlRn" />
</div>
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1HUhl-gkKjZO2APycCl0Z5Bhm_EWcNoWo" />
</div>
</div>
<div class="cell">
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1-g11eGfBGMtng5eW7MSBTmVjGEc7X3KT" />
</div>
<div class="content">
<img src="https://drive.google.com/thumbnail?id=1GIssifV2o9YbcM-b_LDe0AwkBqb7WHkE" />
</div>
</div>
</div>
I am trying to make this image full size but why some space is remaining right side
CSS/HTML
/* Header */
.header {
background: url('https://picsum.photos/1920/1080') center center no-repeat;
background-size: cover;
}
.header .header-content {
padding-top: 15.5rem;
text-align: left;
}
.header .text-container {
margin-top: 3rem;
margin-bottom: 0;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" />
<div id="content">
<!-- start of header -->
<header id="header" class="header">
<div class="header-content"> //here give an class of that image
<div class="container">
<div class="row">
<div class="col-lg-6">
<div class="text-container">
<h1><span class="turquoise">StartUp Landing</span> Page Template Free</h1>
<p class="p-large">Use Evolo free landing page template to promote your business startup and generate leads for the offered services</p>
<a class="btn-solid-lg page-scroll" href="#services">DISCOVER</a>
</div>
<!-- end of text-container -->
</div>
<!-- end of col -->
<div class="col-lg-6">
<div class="image-container">
<img class="img-fluid" src="https://picsum.photos/1920/1088" alt="alternative">
</div>
<!-- end of image-container -->
</div>
<!-- end of col -->
</div>
<!-- end of row -->
</div>
<!-- end of container -->
</div>
<!-- end of header-content -->
</header>
<!-- end of header -->
</div>
I want to set this full image right side(question mark)
which place need correction
add the width and height to body and html in head.
html,body {
width:100%;
height:100%
}
.img-fluid{
width:100%
height:100%
}
.image-container{
width:<!--as you wish--> 20px;
height:<!--as you wish--> 20px;
}
I would like to figure out how to get a series of images to be vertically aligned on the page so people can scroll left to right and view them. I have tried 'vertical-align: middle'as well as adjusting the top % to no avail, here's the current set-up
.page {
position: absolute;
width: 2400px;
vertical-align: middle;
}
.column {
float: left;
width: 400px;
padding: 5px;
}
.row::after {
content: "";
clear: both;
display: table;
}
<div class="page">
<div class="row">
<div class="column">
<img src="https://68.media.tumblr.com/94a2f217cbd0e1d3ae663764bfa3bef3/tumblr_oazuptRyRh1uz08p6o1_1280.jpg" width="100%" />
</div>
<div class="column">
<img src="http://static.tumblr.com/vbfmte2/gRAo4t8mm/icymi_03.png" width="100%" />
</div>
<div class="column">
<img src="http://static.tumblr.com/vbfmte2/QNbo4t8mh/moving_01.png" width="100%" />
</div>
<div class="column">
<img src="https://68.media.tumblr.com/94a2f217cbd0e1d3ae663764bfa3bef3/tumblr_oazuptRyRh1uz08p6o1_1280.jpg" width="100%" />
</div>
<div class="column">
<img src="http://static.tumblr.com/vbfmte2/gRAo4t8mm/image082.png" width="100%" />
</div>
<div class="column">
<img src="http://static.tumblr.com/vbfmte2/QNbo4t8mh/image257.png" width="100%" />
</div>
</div>
</div>
You may use the table-layout , so you get a single line and can use vertical-align:middle from the parent container .
here is an example without float and okay for browsers as old as FF 1 or IE8 . today, grid and flex can do a similar job in that case. Play snippet in full page to check out vertical-align behavior
body {
margin: 0;
padding: 0;
}
.page {
overflow-x: auto;
overflow-y: hidden;
height: 100vh;
box-sizing: border-box;
}
.row {
display: table;
height: 100%;
}
.column {
padding: 5px;
display: table-cell;
vertical-align: middle;
}
.column img {
width: 400px;
}
<div class="page">
<div class="row">
<div class="column">
<img src="https://68.media.tumblr.com/94a2f217cbd0e1d3ae663764bfa3bef3/tumblr_oazuptRyRh1uz08p6o1_1280.jpg" width="100%" />
</div>
<div class="column">
<img src="http://static.tumblr.com/vbfmte2/gRAo4t8mm/icymi_03.png" width="100%" />
</div>
<div class="column">
<img src="http://static.tumblr.com/vbfmte2/QNbo4t8mh/moving_01.png" width="100%" />
</div>
<div class="column">
<img src="https://68.media.tumblr.com/94a2f217cbd0e1d3ae663764bfa3bef3/tumblr_oazuptRyRh1uz08p6o1_1280.jpg" width="100%" />
</div>
<div class="column">
<img src="http://static.tumblr.com/vbfmte2/gRAo4t8mm/image082.png" width="100%" />
</div>
<div class="column">
<img src="http://static.tumblr.com/vbfmte2/QNbo4t8mh/image257.png" width="100%" />
</div>
</div>
</div>
with flex it could be :
body {
margin: 0;
padding: 0;
}
.row {
display: flex;
align-items:center;
min-height:100vh;
box-sizing:border-box;
}
.column {
padding: 5px;
min-width: 400px;
}
<div class="page">
<div class="row">
<div class="column">
<img src="https://68.media.tumblr.com/94a2f217cbd0e1d3ae663764bfa3bef3/tumblr_oazuptRyRh1uz08p6o1_1280.jpg" width="100%" />
</div>
<div class="column">
<img src="http://static.tumblr.com/vbfmte2/gRAo4t8mm/icymi_03.png" width="100%" />
</div>
<div class="column">
<img src="http://static.tumblr.com/vbfmte2/QNbo4t8mh/moving_01.png" width="100%" />
</div>
<div class="column">
<img src="https://68.media.tumblr.com/94a2f217cbd0e1d3ae663764bfa3bef3/tumblr_oazuptRyRh1uz08p6o1_1280.jpg" width="100%" />
</div>
<div class="column">
<img src="http://static.tumblr.com/vbfmte2/gRAo4t8mm/image082.png" width="100%" />
</div>
<div class="column">
<img src="http://static.tumblr.com/vbfmte2/QNbo4t8mh/image257.png" width="100%" />
</div>
</div>
</div>
I want to make a carousel like the one on this website:
https://debut-demo.myshopify.com/
The words stick with the picture it belongs to in the carousel.
I tried to use position: relative and position: absolute to make the words on the background.
1.My HTML
<div class="swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
<div class="swiper-slide">
<h2>title01</h2>
<img src="../src/images/background1.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="../src/images/background2.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="../src/images/background3.jpg" alt="">
</div>
</div>
<!-- If we need pagination -->
<div class="swiper-pagination"></div>
<!-- If we need navigation buttons -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<!-- If we need scrollbar -->
<div class="swiper-scrollbar"></div>
</div>
2.My SCSS
.swiper-container {
.swiper-slide {
max-height: 700px;
position: relative;
img {
-webkit-filter: brightness(.8);
width: 100%;
}
h2 {
top: 245px;
left: 100px;
font-size: 4.0625rem;
z-index: 20;
position: absolute;
}
}
}
enter image description here
enter image description here
I'm relatively new at this level of complexity – at any rate, creating a webpage on the Squarespace platform which will feature a code block that presents a grid of 12 clickable tiles with Hover response and click through functionality. While Squarespace has built in responsiveness, whatever is in the code block is exempt from that.
So, the problem I'm having is that my nicely centered grid of 12 tiles is only centered when displayed on a fully open browser window. As the browser window diminishes in size and the tiles begin stacking, the grid aligns to the right. I've already put the gallery in a div in order to get the original centering.
Is there a way to force centering regardless of browser size?
To see the behavior in action, change Result window size of jsfiddle:
http://jsfiddle.net/terryogara/VQ3hk/
Thank you, and here's the code:
<style type="text/css">
.caption-style-1 li{
list-style-type: none;
margin: 0px;
padding: 5px;
position: relative;
overflow: hidden;
}
.caption-style-1 li:hover .caption{
opacity: 1;
}
.caption-style-1 li:active .caption{
opacity: .5;
}
.caption-style-1 img{
float: left;
}
.caption-style-1 .caption{
cursor: pointer;
position: absolute;
opacity: 0;
-webkit-transition:all 0.45s ease-in-out;
-moz-transition:all 0.45s ease-in-out;
-o-transition:all 0.45s ease-in-out;
-ms-transition:all 0.45s ease-in-out;
transition:all 0.45s ease-in-out;
}
.caption-style-1 .blur{
background-color: rgba(0,0,0,0.65);
height: 180px;
width: 180px;
position: relative;
}
.caption-style-1 .caption-text{
position: absolute;
width: 180px;
height: 180px;
text-align: center;
top:10px;
}
.outer-container {
width: 100%;
min-width: 980px
margin: 0 auto;
text-align: center;
}
.inner-container {
display: inline-block;
}
</style>
<!-- CONTENT -->
<!-- OUTER CONTAINER -->
<div class="outer-container">
<ul class="caption-style-1">
<!-- ROW 1 TOP | IMAGE GALLERY 1 -->
<div class="inner-container">
<!-- IMAGE 1 -->
<div style="float: right;">
<div style="float: right;">
<a href="http://www.example.com">
<li>
<img src="http://murmurhaus.com/wp-content/uploads/2014/07/ph-180x180.png" height="180" width="180" alt="ALT">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>TEXT HERE</h1>
</div>
</div>
</li></a>
</div>
<!-- IMAGE 2 -->
<div style="float: right;">
<a href="http://www.google.com">
<li>
<img src="http://murmurhaus.com/wp-content/uploads/2014/07/ph-180x180.png" height="180" width="180" alt="ALT">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>TEXT HERE</h1>
</div>
</div>
</li></a>
</div>
</div>
<!-- IMAGE 3 -->
<div style="float: right;">
<div style="float: right;">
<a href="http://http://stackoverflow.com/">
<li>
<img src="http://murmurhaus.com/wp-content/uploads/2014/07/ph-180x180.png" height="180" width="180" alt="ALT">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>TEXT HERE</h1>
</div>
</div>
</li></a>
</div>
<!-- IMAGE 4 -->
<div style="float: right;">
<li>
<img src="http://murmurhaus.com/wp-content/uploads/2014/07/ph-180x180.png" height="180" width="180" alt="ALT">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>TEXT HERE</h1>
</div>
</div>
</li></a>
</div>
</div>
<!-- END GALLERY 1-->
<!-- CLOSE INNER CONTAINER -->
</div>
<!-- CLOSE OUTER CONTAINER -->
</ul>
</div>
<!-- END ROW 1 -->