add timing function to css slider - html

Have been trying to get my head around this for days but need some assistance from you css gurus!
I have a pure css slider that uses some controls which is great. The issue is that I want the slider to also move automatically like a timings function. I was trying to do it using keyframes but had no luck.
How would this be possible?
HTML:
<input type="radio" name="slider" class="slide-radio1" checked id="slider_1">
<input type="radio" name="slider" class="slide-radio2" id="slider_2">
<input type="radio" name="slider" class="slide-radio3" id="slider_3">
<input type="radio" name="slider" class="slide-radio4" id="slider_4">
<div class="sliderPagination">
<label for="slider_1" class="page1"></label>
<label for="slider_2" class="page2"></label>
<label for="slider_3" class="page3"></label>
<label for="slider_4" class="page4"></label>
</div>
<div class="next control">
<label for="slider_1" class="numb1"><i class="fa fa-arrow-circle-right"></i></label>
<label for="slider_2" class="numb2"><i class="fa fa-arrow-circle-right"></i></label>
<label for="slider_3" class="numb3"><i class="fa fa-arrow-circle-right"></i></label>
<label for="slider_4" class="numb4"><i class="fa fa-arrow-circle-right"></i></label>
</div>
<div class="previous control">
<label for="slider_1" class="numb1"><i class="fa fa-arrow-circle-left"></i></label>
<label for="slider_2" class="numb2"><i class="fa fa-arrow-circle-left"></i></label>
<label for="slider_3" class="numb3"><i class="fa fa-arrow-circle-left"></i></label>
<label for="slider_4" class="numb4"><i class="fa fa-arrow-circle-left"></i></label>
</div>
<div class="slider slide1">
</div>
<div class="slider slide2">
</div>
<div class="slider slide3">
</div>
<div class="slider slide4">
</div>
</div>
CSS :
/* SLIDER WRAPPER */
.wrapper {
position: relative;
display: block;
overflow: hidden;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.mainSlider.wrapper {
border-bottom: solid 6px #cc2027;
height: 900px;
height: 100vh;
}
/* SLIDER */
.slider {
width: 100%;
height: 100%;
background: #f2f2f2;
position: absolute;
left: 0;
top: 0;
opacity: 1;
z-index: 0;
display: flex;
display: -webkit-flex;
display: -ms-flexbox;
flex-direction: row;
flex-wrap: wrap;
-webkit-transition: -webkit-transform 1600ms;
transition: -webkit-transform 1600ms, transform 1600ms;
-webkit-transform: scale(1);
transform: scale(1);
}
.slider > * {
-webkit-transition: opacity 800ms, -webkit-transform 800ms;
transition: transform 800ms, opacity 800ms;
-webkit-transition-delay: 1s; /* Safari */
transition-delay: 1s;
}
/* CONTROLS */
.control {
position: absolute;
top: 50%;
width: 50px;
height: 50px;
margin-top: -25px;
z-index: 55;
}
.control label {
z-index: 0;
display: none;
text-align: center;
line-height: 50px;
font-size: 50px;
color: #FFF;
cursor: pointer;
opacity: 0.2;
}
.control label:hover {
opacity: 0.5;
}
.next {
right: 1%;
}
.previous {
left: 1%;
}
.sliderPagination {
position: absolute;
bottom: 40px;
width: 100%;
right: 60px;
text-align: right;
z-index: 50;
}
.sliderPagination label {
width: 10px;
height: 10px;
border-radius: 50%;
display: inline-block;
background: #959595;
margin: 0 2px;
border: solid 1px rgba(255,255,255,0.4);
cursor: pointer;
}
.slide-radio1:checked ~ .next .numb2,
.slide-radio2:checked ~ .next .numb3,
.slide-radio3:checked ~ .next .numb4,
.slide-radio2:checked ~ .previous .numb1,
.slide-radio3:checked ~ .previous .numb2,
.slide-radio4:checked ~ .previous .numb3 {
display: block;
z-index: 1
}
/* ACTIVE */
.slide-radio1:checked ~ .sliderPagination .page1,
.slide-radio2:checked ~ .sliderPagination .page2,
.slide-radio3:checked ~ .sliderPagination .page3,
.slide-radio4:checked ~ .sliderPagination .page4 {
background: #cc2027;
}
/* SLIDER ANIMATION */
.slide-radio1:checked ~ .slider {
-webkit-transform: translateX(0%);
transform: translateX(0%);
}
.slide-radio2:checked ~ .slider {
-webkit-transform: translateX(-100%);
transform: translateX(-100%);
}
.slide-radio3:checked ~ .slider {
-webkit-transform: translateX(-200%);
transform: translateX(-200%);
}
.slide-radio4:checked ~ .slider {
-webkit-transform: translateX(-300%);
transform: translateX(-300%);
}
.slide-radio1:checked ~ .slide1 h1,
.slide-radio2:checked ~ .slide2 h1,
.slide-radio3:checked ~ .slide3 h1,
.slide-radio4:checked ~ .slide4 h1,
.slide-radio1:checked ~ .slide1 p,
.slide-radio2:checked ~ .slide2 p,
.slide-radio3:checked ~ .slide3 p,
.slide-radio4:checked ~ .slide4 p,
.slide-radio1:checked ~ .slide1 .button,
.slide-radio2:checked ~ .slide2 .button,
.slide-radio3:checked ~ .slide3 .button,
.slide-radio4:checked ~ .slide4 .button {
-webkit-transform: translateX(0);
transform: translateX(0);
opacity: 1;
}

Related

How do I remove hover transform animation if checkbox is checked using CSS only

How do I remove the
transform-origin: right;
transform: scaleX(0.5);
}
.menu-btn:hover > span:nth-of-type(3){
transform-origin: left;
transform: scaleX(0.5);
}
when the "menu-check" input checkbox is checked since they interfere with transform animations that occur when checked.
Thank you in advance.
.menu-btn {
position: fixed;
display: flex;
flex-direction: column;
gap: 5px;
bottom: 20px;
right: 20px;
padding: 15px;
border-radius: 20px;
z-index: 10;
background-color: #08ccc9;
cursor: pointer;
}
.menu-btn:hover > span:nth-of-type(1) {
transform-origin: right;
transform: scaleX(0.5);
}
.menu-btn:hover > span:nth-of-type(3) {
transform-origin: left;
transform: scaleX(0.5);
}
.menu-btn input {
display: none;
}
.menu-btn span {
width: 25px;
height: 4px;
border-radius: 999px;
background-color: black;
transition: all 0.3s ease;
}
.menu-btn input:checked ~ span:nth-of-type(1) {
transform: rotate(45deg) translate(5px, 7px);
}
.menu-btn input:checked ~ span:nth-of-type(2) {
transform: translate(30px, 0px);
opacity: 0;
}
.menu-btn input:checked ~ span:nth-of-type(3) {
transform: rotate(-45deg) translate(5px, -7px);
}
<label for="menu-check" class="menu-btn">
<input type="checkbox" id="menu-check">
<span></span>
<span></span>
<span></span>
</label>
You can use the input:not(:checked) selector. I'm not sure this is the end result youre going for but here it is applied to your snippet.
.menu-btn {
position: fixed;
display: flex;
flex-direction: column;
gap: 5px;
bottom: 20px;
right: 20px;
padding: 15px;
border-radius: 20px;
z-index: 10;
background-color: #08ccc9;
cursor: pointer;
}
.menu-btn:hover input:not(:checked) ~ span:nth-of-type(1) {
transform-origin: right;
transform: scaleX(0.5);
}
.menu-btn:hover input:not(:checked) ~ span:nth-of-type(3) {
transform-origin: left;
transform: scaleX(0.5);
}
.menu-btn input {
display: none;
}
.menu-btn span {
width: 25px;
height: 4px;
border-radius: 999px;
background-color: black;
transition: all 0.3s ease;
}
.menu-btn input:checked ~ span:nth-of-type(1) {
transform: rotate(45deg) translate(5px, 7px);
}
.menu-btn input:checked ~ span:nth-of-type(2) {
transform: translate(30px, 0px);
opacity: 0;
}
.menu-btn input:checked ~ span:nth-of-type(3) {
transform: rotate(-45deg) translate(5px, -7px);
}
<label for="menu-check" class="menu-btn">
<input type="checkbox" id="menu-check">
<span></span>
<span></span>
<span></span>
</label>
Reset the transform-origin to center on checked and also remove transition from it
.menu-btn {
position: fixed;
display: flex;
flex-direction: column;
gap: 5px;
bottom: 20px;
right: 20px;
padding: 15px;
border-radius: 20px;
z-index: 10;
background-color: #08ccc9;
cursor: pointer;
}
.menu-btn:hover > span:nth-of-type(1) {
transform-origin: right;
transform: scaleX(0.5);
}
.menu-btn:hover > span:nth-of-type(3) {
transform-origin: left;
transform: scaleX(0.5);
}
.menu-btn input {
display: none;
}
.menu-btn span {
width: 25px;
height: 4px;
border-radius: 999px;
background-color: black;
transition: all 0.3s ease;
}
.menu-btn input:checked ~ span:nth-of-type(1) {
transform: rotate(45deg) translate(6px, 7px);
/* added */
transform-origin: center;
transition: all 0.3s ease,transform-origin 0s;
}
.menu-btn input:checked ~ span:nth-of-type(2) {
transform: translate(30px, 0px);
opacity: 0;
}
.menu-btn input:checked ~ span:nth-of-type(3) {
transform: rotate(-45deg) translate(5px, -7px);
/* added */
transform-origin: center;
transition: all 0.3s ease,transform-origin 0s;
}
<label for="menu-check" class="menu-btn">
<input type="checkbox" id="menu-check">
<span></span>
<span></span>
<span></span>
</label>

Icons are not showing up

On "Codepen.io" I've found a nice CSS for a circle menu which I would like to use. (https://codepen.io/oliver_merz/pen/zqXZQG). But as you can see the labels (buttons) are empty. There should be images in it. I've tested this with a random image (https://image.flaticon.com/icons/svg/771/771605.svg). Unfortunately, nothing shows up..
It's about the following CSS code:
.cssplay-menu .segment label {
display: block;
position: absolute;
left: 50%;
top: 50%;
width: 50%;
height: 50%;
background: #008080;
border: 1px solid #fff;
cursor: pointer;
transform-origin: left top;
transition: 0.25s cubic-bezier(0, 0, 1, 1);
transition: 0.25s ease;
}
You need to adjust some CSS to make them visible because actually they are hidden:
.cssplay-menu .segment label span {
display: block;
position: absolute;
left: 0;
top: 0;
right: 50%; /*changed*/
bottom: 10%; /*changed*/
margin: auto;
width: 35px;
height: 35px;
background-position: center center;
background-repeat: no-repeat;
}
Full code
.cssplay-menu {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
position: relative;
margin: 20px auto 0;
width: 100%;
max-width: 568px;
height: 0;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
transform: translate3d(0, 0, 0);
}
.cssplay-menu > div {
position: relative;
margin-bottom: 250px;
padding-bottom: 100%;
max-width: 100%;
height: 0;
}
.cssplay-menu * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.cssplay-menu .holder {
position: relative;
padding-bottom: 100%;
max-width: 100%;
height: 0;
overflow: hidden;
}
.cssplay-menu input {
position: absolute;
display: none;
}
.cssplay-menu .segment {
position: absolute;
z-index: 100;
left: 50%;
top: 50%;
margin-left: -48%;
margin-top: -48%;
width: 96%;
height: 96%;
border-radius: 50%;
overflow: hidden;
transform: scale(0);
transition: 0.5s cubic-bezier(.58, 2.4, 0.5, 0.5);
transition: 0.5s ease;
}
.cssplay-menu .curve-upper {
position: absolute;
left: 1%;
top: 1%;
width: 98%;
height: 98%;
background: #fff;
border-radius: 50%;
transform: scale(0);
transition: 0s;
}
.cssplay-menu .curve-lower {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
border-radius: 50%;
overflow: hidden;
transform: rotate(-140deg) scale(0);
transition: 0s;
}
.cssplay-menu .curve {
display: block;
position: absolute;
left: 50%;
top: 50%;
width: 100%;
height: 100%;
background: #8b0000;
transform-origin: left top;
transform: rotate(0deg) skewY(50deg);
}
.cssplay-menu .segment label {
display: block;
position: absolute;
left: 50%;
top: 50%;
width: 50%;
height: 50%;
background: #008080;
border: 1px solid #fff;
cursor: pointer;
transform-origin: left top;
transition: 0.25s cubic-bezier(0, 0, 1, 1);
transition: 0.25s ease;
}
.cssplay-menu .segment label span {
display: block;
position: absolute;
left: 0;
top: 0;
right: 50%;
bottom: 10%;
margin: auto;
width: 35px;
height: 35px;
background:url(https://image.flaticon.com/icons/svg/771/771605.svg);
background-position: center center;
background-repeat: no-repeat;
}
.cssplay-menu .segment label:nth-of-type(1) {
transform: rotate(-140deg) skewY(50deg);
}
.cssplay-menu .segment label:nth-of-type(2) {
transform: rotate(-100deg) skewY(50deg);
}
.cssplay-menu .segment label:nth-of-type(3) {
transform: rotate(-60deg) skewY(50deg);
}
.cssplay-menu .segment label:nth-of-type(4) {
transform: rotate(-20deg) skewY(50deg);
}
.cssplay-menu .segment label:nth-of-type(5) {
transform: rotate(20deg) skewY(50deg);
}
.cssplay-menu .segment label:nth-of-type(6) {
transform: rotate(60deg) skewY(50deg);
}
.cssplay-menu .segment label:nth-of-type(7) {
transform: rotate(100deg) skewY(50deg);
}
.cssplay-menu .segment label:nth-of-type(8) {
transform: rotate(140deg) skewY(50deg);
}
.cssplay-menu .segment label:nth-of-type(9) {
transform: rotate(180deg) skewY(50deg);
}
.cssplay-menu .segment label:nth-of-type(1) span {
transform: skewY(-50deg) rotate(0deg);
}
.cssplay-menu .segment label:nth-of-type(2) span {
transform: skewY(-50deg) rotate(-40deg);
}
.cssplay-menu .segment label:nth-of-type(3) span {
transform: skewY(-50deg) rotate(-80deg);
}
.cssplay-menu .segment label:nth-of-type(4) span {
transform: skewY(-50deg) rotate(-120deg);
}
.cssplay-menu .segment label:nth-of-type(5) span {
transform: skewY(-50deg) rotate(-160deg);
}
.cssplay-menu .segment label:nth-of-type(6) span {
transform: skewY(-50deg) rotate(-200deg);
}
.cssplay-menu .segment label:nth-of-type(7) span {
transform: skewY(-50deg) rotate(-240deg);
}
.cssplay-menu .segment label:nth-of-type(8) span {
transform: skewY(-50deg) rotate(-280deg);
}
.cssplay-menu .segment label:nth-of-type(9) span {
transform: skewY(-50deg) rotate(-320deg);
}
.cssplay-menu .center {
display: block;
position: absolute;
z-index: 200;
left: 50%;
top: 50%;
margin-left: -20%;
margin-top: -20%;
width: 40%;
height: 40%;
border-radius: 50%;
background: #8b0000 url(cubic/settings.png) no-repeat center center;
overflow: hidden;
cursor: pointer;
box-shadow: 0 0 0 2px #fff;
}
.cssplay-menu #toggle:checked + .holder .segment {
transition: 0.5s cubic-bezier(.58, 3, 0.5, 0.5);
transition: 0.5s ease;
transform: scale(1);
}
.cssplay-menu #toggle:checked + .holder .center {
transition: 0.5s cubic-bezier(.58, 3, 0.5, 0.5);
transition: 0.5s ease;
transform: scale(1.2);
}
.cssplay-menu #toggle:checked + .holder .curve-upper {
transition: 0.5s cubic-bezier(.58, 3, 0.5, 0.5);
transition: 1s ease;
transform: scale(1);
}
.cssplay-menu #toggle:checked + .holder .curve-lower {
transition: 0.5s cubic-bezier(.58, 3, 0.5, 0.5);
transition: 1s ease;
transform: rotate(-140deg) scale(1);
}
.cssplay-menu #c1:checked ~ .holder .segment label:nth-of-type(1),
.cssplay-menu #c2:checked ~ .holder .segment label:nth-of-type(2),
.cssplay-menu #c3:checked ~ .holder .segment label:nth-of-type(3),
.cssplay-menu #c4:checked ~ .holder .segment label:nth-of-type(4),
.cssplay-menu #c5:checked ~ .holder .segment label:nth-of-type(5),
.cssplay-menu #c6:checked ~ .holder .segment label:nth-of-type(6),
.cssplay-menu #c7:checked ~ .holder .segment label:nth-of-type(7),
.cssplay-menu #c8:checked ~ .holder .segment label:nth-of-type(8),
.cssplay-menu #c9:checked ~ .holder .segment label:nth-of-type(9) {
background: #eb8c00;
}
.cssplay-menu #c1:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(-140deg)
}
.cssplay-menu #c2:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(-100deg)
}
.cssplay-menu #c3:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(-60deg)
}
.cssplay-menu #c4:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(-20deg)
}
.cssplay-menu #c5:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(20deg)
}
.cssplay-menu #c6:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(60deg)
}
.cssplay-menu #c7:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(100deg)
}
.cssplay-menu #c8:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(140deg)
}
.cssplay-menu #c9:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(180deg)
}
.cssplay-menu .sub {
position: absolute;
left: 50%;
top: 100%;
margin-left: -50%;
width: 100%;
height: 0;
overflow: hidden;
}
.cssplay-menu .sub dl {
position: absolute;
top: -190px;
left: 50%;
margin-left: -25%;
padding: 0;
width: 50%;
opacity: 0;
transition: 0.5s cubic-bezier(.58, 3, 0.5, 0.5);
transition: all 0.5s ease;
}
.cssplay-menu .sub dl dt {
text-align: center;
font: bold 16px/20px 'Lato', arial, sans-serif;
color: #8b0000;
}
.cssplay-menu .sub dl dd {
margin: 0;
padding: 0;
text-align: center;
font: normal 15px/20px 'Lato', arial, sans-serif;
color: #000;
}
.cssplay-menu .sub dl dd a {
color: #004040;
}
.cssplay-menu #c1:checked ~ #toggle:checked ~ .sub dl:nth-of-type(1),
.cssplay-menu #c2:checked ~ #toggle:checked ~ .sub dl:nth-of-type(2),
.cssplay-menu #c3:checked ~ #toggle:checked ~ .sub dl:nth-of-type(3),
.cssplay-menu #c4:checked ~ #toggle:checked ~ .sub dl:nth-of-type(4),
.cssplay-menu #c5:checked ~ #toggle:checked ~ .sub dl:nth-of-type(5),
.cssplay-menu #c6:checked ~ #toggle:checked ~ .sub dl:nth-of-type(6),
.cssplay-menu #c7:checked ~ #toggle:checked ~ .sub dl:nth-of-type(7),
.cssplay-menu #c8:checked ~ #toggle:checked ~ .sub dl:nth-of-type(8),
.cssplay-menu #c9:checked ~ #toggle:checked ~ .sub dl:nth-of-type(9) {
top: 20px;
opacity: 1;
transition: 0.5s cubic-bezier(.58, 3, 0.5, 0.5) 0.5s;
transition: opacity 0.5s ease, top 0.5s ease 0.5s;
}
.cssplay-menu #c1:checked ~ #toggle:checked ~ .sub,
.cssplay-menu #c2:checked ~ #toggle:checked ~ .sub,
.cssplay-menu #c3:checked ~ #toggle:checked ~ .sub,
.cssplay-menu #c4:checked ~ #toggle:checked ~ .sub,
.cssplay-menu #c5:checked ~ #toggle:checked ~ .sub,
.cssplay-menu #c6:checked ~ #toggle:checked ~ .sub,
.cssplay-menu #c7:checked ~ #toggle:checked ~ .sub,
.cssplay-menu #c8:checked ~ #toggle:checked ~ .sub,
.cssplay-menu #c9:checked ~ #toggle:checked ~ .sub {
height: 250px
}
<div class="cssplay-menu">
<div>
<input type="radio" id="c1" name="segment" checked="checked">
<input type="radio" id="c2" name="segment">
<input type="radio" id="c3" name="segment">
<input type="radio" id="c4" name="segment">
<input type="radio" id="c5" name="segment">
<input type="radio" id="c6" name="segment">
<input type="radio" id="c7" name="segment">
<input type="radio" id="c8" name="segment">
<input type="radio" id="c9" name="segment">
<input type="checkbox" id="toggle" checked="checked">
<div class="holder">
<div class="segment">
<label for="c1"><span></span></label>
<label for="c2"><span></span></label>
<label for="c3"><span></span></label>
<label for="c4"><span></span></label>
<label for="c5"><span></span></label>
<label for="c6"><span></span></label>
<label for="c7"><span></span></label>
<label for="c8"><span></span></label>
<label for="c9"><span></span></label>
</div>
<div class="curve-lower">
<div class="curve"></div>
</div>
<div class="curve-upper"></div>
<label for="toggle" class="center"></label>
</div>
<div class="sub">
<dl>
<dt>SUB MENU #1</dt>
<dd>Item #1.1</dd>
<dd>Item #1.2</dd>
<dd>Item #1.3</dd>
<dd>Item #1.4</dd>
</dl>
<dl>
<dt>SUB MENU #2</dt>
<dd>Item #2.1</dd>
<dd>Item #2.2</dd>
<dd>Item #2.3</dd>
</dl>
<dl>
<dt>SUB MENU #3</dt>
<dd>Item #3.1</dd>
<dd>Item #3.2</dd>
<dd>Item #3.3</dd>
<dd>Item #3.4</dd>
</dl>
<dl>
<dt>SUB MENU #4</dt>
<dd>Item #4.1</dd>
<dd>Item #4.2</dd>
<dd>Item #4.3</dd>
<dd>Item #4.4</dd>
<dd>Item #4.5</dd>
</dl>
<dl>
<dt>SUB MENU #5</dt>
<dd>Item #5.1</dd>
<dd>Item #5.2</dd>
<dd>Item #5.3</dd>
<dd>Item #5.4</dd>
</dl>
<dl>
<dt>SUB MENU #6</dt>
<dd>Item #6.1</dd>
<dd>Item #6.2</dd>
<dd>Item #6.3</dd>
</dl>
<dl>
<dt>SUB MENU #7</dt>
<dd>Item #7.1</dd>
<dd>Item #7.2</dd>
<dd>Item #7.3</dd>
<dd>Item #7.4</dd>
</dl>
<dl>
<dt>SUB MENU #8</dt>
<dd>Item #8.1</dd>
<dd>Item #8.2</dd>
<dd>Item #8.3</dd>
<dd>Item #8.4</dd>
</dl>
<dl>
<dt>SUB MENU #9</dt>
<dd>Item #9.1</dd>
<dd>Item #9.2</dd>
<dd>Item #9.3</dd>
<dd>Item #9.4</dd>
</dl>
</div>
</div>
</div>

How to align the font icons and text in a circle?

I'm working for a couple of hours to align the font icons and text within the CSS below. It doesn't really sound like a hard thing to do. The aligning is based on a 'circle', and after a while playing with the CSS, I end up pretty confused.. So I hope someone else has experienced this and knows a way how to align them correctly, in the middle..
.css-menu {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
position: relative;
margin: 10px auto 0;
width: 100%;
max-width: 568px;
height: 0;
}
.css-menu>div {
position: relative;
margin-bottom: 250px;
padding-bottom: 100%;
max-width: 100%;
height: 0;
}
.css-menu * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.css-menu input {
position: absolute;
display: none;
}
.css-menu .segment {
position: absolute;
z-index: 100;
left: 50%;
top: 50%;
margin-left: -48%;
margin-top: -48%;
width: 96%;
height: 96%;
border-radius: 50%;
overflow: hidden;
transform: scale(0);
transition: 0.5s cubic-bezier(.58, 2.4, 0.5, 0.5);
transition: 0.5s ease;
}
.css-menu .curve-upper {
position: absolute;
left: 1%;
top: 1%;
width: 98%;
height: 98%;
background: #fff;
border-radius: 50%;
transform: scale(0);
transition: 0s;
}
.css-menu .curve-lower {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
border-radius: 50%;
overflow: hidden;
transform: rotate(-130deg) scale(0);
transition: 0s;
}
.css-menu .curve {
display: block;
position: absolute;
left: 50%;
top: 50%;
width: 100%;
height: 100%;
background: #000;
transform-origin: left top;
transform: rotate(0deg) skewY(45deg);
}
.css-menu .segment label {
display: block;
position: absolute;
left: 50%;
top: 50%;
width: 50%;
height: 50%;
background: #567a98;
border: 1px solid #fff;
cursor: pointer;
transform-origin: left top;
transition: 0.25s cubic-bezier(0, 0, 1, 1);
transition: 0.25s ease;
}
.css-menu .segment label span {
display: block;
position: absolute;
left: 0;
top: 0;
right: 35%;
bottom: 25%;
margin: auto;
width: 35px;
height: 100px;
font-size: 3rem;
font-weight: normal;
color: #fff;
}
.fab:after {
content: attr(data-label);
font-family: 'Nexa Light', sans-serif;
font-size: 14px;
font-weight: 700;
margin-top: 10px;
color: #fff;
display: block;
text-align: center;
position: relative;
left: 50%;
transform: translateX(-50%);
}
.css-menu .segment label:nth-of-type(1) {
transform: rotate(-135deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(2) {
transform: rotate(-90deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(3) {
transform: rotate(-45deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(4) {
transform: rotate(-0deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(5) {
transform: rotate(45deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(6) {
transform: rotate(90deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(7) {
transform: rotate(135deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(8) {
transform: rotate(180deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(1) span {
transform: skewY(-45deg) rotate(135deg);
}
.css-menu .segment label:nth-of-type(2) span {
transform: skewY(-45deg) rotate(90deg);
}
.css-menu .segment label:nth-of-type(3) span {
transform: skewY(-45deg) rotate(45deg);
}
.css-menu .segment label:nth-of-type(4) span {
transform: skewY(-45deg) rotate(0deg);
}
.css-menu .segment label:nth-of-type(5) span {
transform: skewY(-45deg) rotate(-45deg);
}
.css-menu .segment label:nth-of-type(6) span {
transform: skewY(-45deg) rotate(-90deg);
}
.css-menu .segment label:nth-of-type(7) span {
transform: skewY(-45deg) rotate(-135deg);
}
.css-menu .segment label:nth-of-type(8) span {
transform: skewY(-45deg) rotate(-180deg);
}
.css-menu .center {
display: block;
position: absolute;
z-index: 200;
left: 50%;
top: 50%;
margin-left: -17.5%;
margin-top: -17.5%;
width: 35%;
height: 35%;
border-radius: 50%;
background: #000;
overflow: hidden;
box-shadow: 0 0 0 2px #fff;
}
.css-menu .holder .segment {
transition: 0.5s cubic-bezier(.58, 3, 0.5, 0.5);
transition: 0.5s ease;
transform: scale(1);
}
.css-menu .holder .center {
transition: 0.5s cubic-bezier(.58, 3, 0.5, 0.5);
transition: 0.5s ease;
transform: scale(1.2);
}
.css-menu .holder .curve-upper {
transition: 0.5s cubic-bezier(.58, 3, 0.5, 0.5);
transition: 1s ease;
transform: scale(1);
}
.css-menu .holder .curve-lower {
transition: 0.5s cubic-bezier(.58, 3, 0.5, 0.5);
transition: 1s ease;
transform: rotate(-135deg) scale(1);
}
.css-menu #c1:checked~.holder .segment label:nth-of-type(1),
.css-menu #c2:checked~.holder .segment label:nth-of-type(2),
.css-menu #c3:checked~.holder .segment label:nth-of-type(3),
.css-menu #c4:checked~.holder .segment label:nth-of-type(4),
.css-menu #c5:checked~.holder .segment label:nth-of-type(5),
.css-menu #c6:checked~.holder .segment label:nth-of-type(6),
.css-menu #c7:checked~.holder .segment label:nth-of-type(7),
.css-menu #c8:checked~.holder .segment label:nth-of-type(8) {
background: #45acea;
}
.css-menu #c1:checked~#toggle:checked~.holder .curve-lower {
transform: rotate(-135deg)
}
.css-menu #c2:checked~#toggle:checked~.holder .curve-lower {
transform: rotate(-90deg)
}
.css-menu #c3:checked~#toggle:checked~.holder .curve-lower {
transform: rotate(-45deg)
}
.css-menu #c4:checked~#toggle:checked~.holder .curve-lower {
transform: rotate(0deg)
}
.css-menu #c5:checked~#toggle:checked~.holder .curve-lower {
transform: rotate(45deg)
}
.css-menu #c6:checked~#toggle:checked~.holder .curve-lower {
transform: rotate(90deg)
}
.css-menu #c7:checked~#toggle:checked~.holder .curve-lower {
transform: rotate(135deg)
}
.css-menu #c8:checked~#toggle:checked~.holder .curve-lower {
transform: rotate(180deg)
}
.css-eye {
display: block;
width: 100%;
height: 100%;
background-color: white;
border: 0.25em solid black;
border-radius: 50%;
position: relative;
box-shadow: 0.03em 0.14em rgba(0, 0, 0, 0.1);
animation: blink forwards infinite 10s ease-in-out;
z-index: 205;
}
.css-pupil {
position: absolute;
margin-left: 25%;
margin-top: 25%;
width: 50%;
height: 50%;
font-size: 200px;
border-radius: 50%;
background-color: black;
border: 0.1em solid #00aeef;
box-shadow: 0 0 0 0.02em black;
box-sizing: border-box;
will-change: transform;
transition: transform 200ms 300ms ease-in-out;
}
#keyframes blink {
0%,
2%,
60%,
62%,
100% {
transform: scaleX(1) scaleY(1);
}
1%,
61% {
transform: scaleX(1.3) scaleY(0.1);
}
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<div class="screen">
<div class="css-menu">
<div>
<input type="radio" id="c1" name="segment" checked>
<input type="radio" id="c2" name="segment">
<input type="radio" id="c3" name="segment">
<input type="radio" id="c4" name="segment">
<input type="radio" id="c5" name="segment">
<input type="radio" id="c6" name="segment">
<input type="radio" id="c7" name="segment">
<input type="radio" id="c8" name="segment">
<input type="checkbox" id="toggle" checked="checked">
<div class="holder">
<div class="segment">
<label for="c1"><span class="fab fa-bitcoin" data-label="Test 1"></span></label>
<label for="c2"><span class="fab fa-bluetooth" data-label="Test 2"></span></label>
<label for="c3"><span class="fab fa-angellist" data-label="Test 3"></span></label>
<label for="c4"><span class="fab fa-apple-pay" data-label="Test 4"></span></label>
<label for="c5"><span class="fab fa-bimobject" data-label="Test 5"></span></label>
<label for="c6"><span class="fab fa-app-store" data-label="Test 6"></span></label>
<label for="c7"><span class="fab fa-bandcamp" data-label="Test 7"></span></label>
<label for="c8"><span class="fab fa-affiliatetheme" data-label="Test 8"></span></label>
</div>
<div class="curve-lower">
<div class="curve"></div>
</div>
<div class="curve-upper"></div>
<div class="center">
<div class="css-eye">
<div class="css-pupil" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
you can use flexbox for this. Read the CSS added to the end of css part
.css-menu {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
position: relative;
margin: 10px auto 0;
width: 100%;
max-width: 568px;
height: 0;
}
.css-menu > div {
position: relative;
margin-bottom: 250px;
padding-bottom: 100%;
max-width: 100%;
height: 0;
}
.css-menu * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.css-menu input {
position: absolute;
display: none;
}
.css-menu .segment {
position: absolute;
z-index: 100;
left: 50%;
top: 50%;
margin-left: -48%;
margin-top: -48%;
width: 96%;
height: 96%;
border-radius: 50%;
overflow: hidden;
transform: scale(0);
transition: 0.5s cubic-bezier(.58, 2.4, 0.5, 0.5);
transition: 0.5s ease;
}
.css-menu .curve-upper {
position: absolute;
left: 1%;
top: 1%;
width: 98%;
height: 98%;
background: #fff;
border-radius: 50%;
transform: scale(0);
transition: 0s;
}
.css-menu .curve-lower {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
border-radius: 50%;
overflow: hidden;
transform: rotate(-130deg) scale(0);
transition: 0s;
}
.css-menu .curve {
display: block;
position: absolute;
left: 50%;
top: 50%;
width: 100%;
height: 100%;
background: #000;
transform-origin: left top;
transform: rotate(0deg) skewY(45deg);
}
.css-menu .segment label {
display: block;
position: absolute;
left: 50%;
top: 50%;
width: 50%;
height: 50%;
background: #567a98;
border: 1px solid #fff;
cursor: pointer;
transform-origin: left top;
transition: 0.25s cubic-bezier(0, 0, 1, 1);
transition: 0.25s ease;
}
.css-menu .segment label span {
display: block;
position: absolute;
left: 0;
top: 0;
right: 35%;
bottom: 25%;
margin: auto;
width: 35px;
height: 100px;
font-size: 3rem;
font-weight: normal;
color: #fff;
}
.fab:after{
content: attr(data-label);
font-family: 'Nexa Light', sans-serif;
font-size: 14px;
font-weight: 700;
margin-top: 10px;
color: #fff;
display: block;
text-align: center;
position: relative;
left: 50%;
transform: translateX(-50%);
}
.css-menu .segment label:nth-of-type(1) {
transform: rotate(-135deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(2) {
transform: rotate(-90deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(3) {
transform: rotate(-45deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(4) {
transform: rotate(-0deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(5) {
transform: rotate(45deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(6) {
transform: rotate(90deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(7) {
transform: rotate(135deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(8) {
transform: rotate(180deg) skewY(45deg);
}
.css-menu .segment label:nth-of-type(1) span {
transform: skewY(-45deg) rotate(135deg);
}
.css-menu .segment label:nth-of-type(2) span {
transform: skewY(-45deg) rotate(90deg);
}
.css-menu .segment label:nth-of-type(3) span {
transform: skewY(-45deg) rotate(45deg);
}
.css-menu .segment label:nth-of-type(4) span {
transform: skewY(-45deg) rotate(0deg);
}
.css-menu .segment label:nth-of-type(5) span {
transform: skewY(-45deg) rotate(-45deg);
}
.css-menu .segment label:nth-of-type(6) span {
transform: skewY(-45deg) rotate(-90deg);
}
.css-menu .segment label:nth-of-type(7) span {
transform: skewY(-45deg) rotate(-135deg);
}
.css-menu .segment label:nth-of-type(8) span {
transform: skewY(-45deg) rotate(-180deg);
}
.css-menu .center {
display: block;
position: absolute;
z-index: 200;
left: 50%;
top: 50%;
margin-left: -17.5%;
margin-top: -17.5%;
width: 35%;
height: 35%;
border-radius: 50%;
background: #000;
overflow: hidden;
box-shadow: 0 0 0 2px #fff;
}
.css-menu .holder .segment {
transition: 0.5s cubic-bezier(.58, 3, 0.5, 0.5);
transition: 0.5s ease;
transform: scale(1);
}
.css-menu .holder .center {
transition: 0.5s cubic-bezier(.58, 3, 0.5, 0.5);
transition: 0.5s ease;
transform: scale(1.2);
}
.css-menu .holder .curve-upper {
transition: 0.5s cubic-bezier(.58, 3, 0.5, 0.5);
transition: 1s ease;
transform: scale(1);
}
.css-menu .holder .curve-lower {
transition: 0.5s cubic-bezier(.58, 3, 0.5, 0.5);
transition: 1s ease;
transform: rotate(-135deg) scale(1);
}
.css-menu #c1:checked ~ .holder .segment label:nth-of-type(1),
.css-menu #c2:checked ~ .holder .segment label:nth-of-type(2),
.css-menu #c3:checked ~ .holder .segment label:nth-of-type(3),
.css-menu #c4:checked ~ .holder .segment label:nth-of-type(4),
.css-menu #c5:checked ~ .holder .segment label:nth-of-type(5),
.css-menu #c6:checked ~ .holder .segment label:nth-of-type(6),
.css-menu #c7:checked ~ .holder .segment label:nth-of-type(7),
.css-menu #c8:checked ~ .holder .segment label:nth-of-type(8) {
background: #45acea;
}
.css-menu #c1:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(-135deg)
}
.css-menu #c2:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(-90deg)
}
.css-menu #c3:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(-45deg)
}
.css-menu #c4:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(0deg)
}
.css-menu #c5:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(45deg)
}
.css-menu #c6:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(90deg)
}
.css-menu #c7:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(135deg)
}
.css-menu #c8:checked ~ #toggle:checked ~ .holder .curve-lower {
transform: rotate(180deg)
}
.css-eye {
display: block;
width: 100%;
height: 100%;
background-color: white;
border:0.25em solid black;
border-radius: 50%;
position: relative;
box-shadow: 0.03em 0.14em rgba(0,0,0,0.1);
animation: blink forwards infinite 10s ease-in-out;
z-index:205;
}
.css-pupil {
position: absolute;
margin-left: 25%;
margin-top: 25%;
width: 50%;
height: 50%;
font-size: 200px;
border-radius: 50%;
background-color: black;
border: 0.1em solid #00aeef;
box-shadow: 0 0 0 0.02em black;
box-sizing: border-box;
will-change: transform;
transition: transform 200ms 300ms ease-in-out;
}
#keyframes blink {
0%, 2%, 60%, 62%, 100% { transform: scaleX(1) scaleY(1); }
1%, 61% { transform: scaleX(1.3) scaleY(0.1); }
}
.css-menu .segment label > span {
display: flex;
flex-direction: column;
align-items: center;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<div class="screen">
<div class="css-menu">
<div>
<input type="radio" id="c1" name="segment" checked>
<input type="radio" id="c2" name="segment">
<input type="radio" id="c3" name="segment">
<input type="radio" id="c4" name="segment">
<input type="radio" id="c5" name="segment">
<input type="radio" id="c6" name="segment">
<input type="radio" id="c7" name="segment">
<input type="radio" id="c8" name="segment">
<input type="checkbox" id="toggle" checked="checked">
<div class="holder">
<div class="segment">
<label for="c1"><span class="fab fa-bitcoin" data-label="Test 1"></span></label>
<label for="c2"><span class="fab fa-bluetooth" data-label="Test 2"></span></label>
<label for="c3"><span class="fab fa-angellist" data-label="Test 3"></span></label>
<label for="c4"><span class="fab fa-apple-pay" data-label="Test 4"></span></label>
<label for="c5"><span class="fab fa-bimobject" data-label="Test 5"></span></label>
<label for="c6"><span class="fab fa-app-store" data-label="Test 6"></span></label>
<label for="c7"><span class="fab fa-bandcamp" data-label="Test 7"></span></label>
<label for="c8"><span class="fab fa-affiliatetheme" data-label="Test 8"></span></label>
</div>
<div class="curve-lower">
<div class="curve"></div>
</div>
<div class="curve-upper"></div>
<div class="center">
<div class="css-eye">
<div class="css-pupil"/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

Radio button under image sliders with pure CSS

Currently the image slider is fix width a radio button is position by line-height. If the image width is switch to 100%, how do The radio button remain at the bottom of the image in responsive layout?
CSS
.slideshow{
width:640px;
height:360px;
max-height:760px;
position:relative;
text-align:center;.slideshow {
width: 640px;
height: 360px;
max-height: 760px;
position: relative;
text-align: center;
line-height: 75px;
padding-bottom: 30px;
}
.slideshow input[type="radio"] {
font-size: 0.75em;
width: 1em;
height: 1em;
display: inline-block;
position: relative;
top: 0;
bottom: 0;
z-index: 99;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: #ccc;
border-radius: 1em;
transition: 0.3s ease-out background, 0.3s ease-out transform;
}
.slideshow input[type="radio"]:checked {
background: #999;
outline: 0;
-webkit-transform: scale(1.3);
-moz-transform: scale(1.3);
transform: scale(1.3);
}
.slideshow .slideshow-item {
width: 640px;
height: 360px;
line-height: 1.5;
position: absolute;
top: 0;
opacity: 0;
transition: 0.3s ease-out opacity;
}
.slideshow .slideshow-item label {
position: absolute;
top: 0;
bottom: 0;
width: 50%;
display: none;
z-index: 88;
cursor: pointer;
color: transparent;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.slideshow .slideshow-item label:after {
display: block;
content: "\25B6";
font-size: 2em;
color: #fff;
position: absolute;
top: 50%;
right: 10px;
margin-top: -0.5em;
}
.slideshow .slideshow-item label.previous {
left: 0;
display: block;
}
.slideshow .slideshow-item label.previous:after {
-webkit-transform: scaleX(-1);
-moz-transform: scaleX(-1);
transform: scaleX(-1);
right: auto;
left: 10px;.slideshow {
width: 640px;
height: 360px;
max-height: 760px;
position: relative;
text-align: center;
line-height: 75px;
padding-bottom: 30px;
}
.slideshow input[type="radio"] {
font-size: 0.75em;
width: 1em;
height: 1em;
display: inline-block;
position: relative;
top: 0;
bottom: 0;
z-index: 99;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: #ccc;
border-radius: 1em;
transition: 0.3s ease-out background, 0.3s ease-out transform;
}
.slideshow input[type="radio"]:checked {
background: #999;
outline: 0;
-webkit-transform: scale(1.3);
-moz-transform: scale(1.3);
transform: scale(1.3);
}
.slideshow .slideshow-item {
width: 640px;
height: 360px;
line-height: 1.5;
position: absolute;
top: 0;
opacity: 0;
transition: 0.3s ease-out opacity;
}
.slideshow .slideshow-item label {
position: absolute;
top: 0;
bottom: 0;
width: 50%;
display: none;
z-index: 88;
cursor: pointer;
color: transparent;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.slideshow .slideshow-item label:after {
display: block;
content: "\25B6";
font-size: 2em;
color: #fff;
position: absolute;
top: 50%;
right: 10px;
margin-top: -0.5em;
}
.slideshow .slideshow-item label.previous {
left: 0;
display: block;
}
.slideshow .slideshow-item label.previous:after {
-webkit-transform: scaleX(-1);
-moz-transform: scaleX(-1);
transform: scaleX(-1);
right: auto;
left: 10px;
}
.slideshow .slideshow-item label.next {
left: 50%;
display: block;
}
.slideshow input[type="radio"]:checked + .slideshow-item {
opacity: 1;
}
}
.slideshow .slideshow-item label.next {
left: 50%;
display: block;
}
.slideshow input[type="radio"]:checked + .slideshow-item {
opacity: 1;
}
line-height:75px;padding-bottom:30px}.slideshow input[type=radio]{
font-size:.75em;
width:1em;height:1em;
display:inline-block;
position:relative;
top:0;
bottom:0;
z-index:99;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#ccc;border-radius:1em;transition:.3s ease-out background,.3s ease-out transform}
.slideshow input[type=radio]:checked{
background:#999;outline:0;-webkit-transform:scale(1.3);-moz-transform:scale(1.3);transform:scale(1.3)}.slideshow .slideshow-item{width:640px;height:360px;line-height:1.5;position:absolute;top:0;opacity:0;transition:.3s ease-out opacity}.slideshow .slideshow-item label{position:absolute;top:0;bottom:0;width:50%;display:none;z-index:88;cursor:pointer;color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.slideshow .slideshow-item label:after{display:block;content:'\25B6';font-size:2em;color:#fff;position:absolute;top:50%;right:10px;margin-top:-.5em}.slideshow .slideshow-item label.previous{left:0;display:block}.slideshow .slideshow-item label.previous:after{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);transform:scaleX(-1);right:auto;left:10px}.slideshow .slideshow-item label.next{left:50%;display:block}.slideshow input[type=radio]:checked+.slideshow-item{opacity:1}
HTML
<div class="page">
<h1>Pure CSS slideshow</h1>
<p>A proof of concept to have an image slideshow without javascript</p>
<div class="slideshow">
<input type="radio" name="slide" id="item-1" checked="checked" />
<div class="slideshow-item">
<img src="http://lorempixel.com/640/360/sports/1" />
<label for="item-3" class="previous">Go to slide 3</label>
<label for="item-2" class="next">Go to slide 2</label>
</div>
<input type="radio" name="slide" id="item-2" />
<div class="slideshow-item">
<img src="http://lorempixel.com/640/360/sports/2" />
<label for="item-1" class="previous">Go to slide 1</label>
<label for="item-3" class="next">Go to slide 3</label>
</div>
<input type="radio" name="slide" id="item-3" />
<div class="slideshow-item">
<img src="http://lorempixel.com/640/360/sports/3" />
<label for="item-2" class="previous">Go to slide 2</label>
<label for="item-1" class="next">Go to slide 1</label>
</div>
</div>
<p>By #joggink | View on github</p>
</div>
Link Here
if your slideshow height is fixed using can use CSS translateY. codepen
.slideshow{
width:100%;
height:360px;
position:relative;
text-align:center;
padding-bottom:30px;
background-color:green;
}
.slideshow input[type=radio]{
font-size:.75em;
width:1em;
height:1em;
display:inline-block;
position:relative;
z-index:99;
transform: translateY(360px);
-webkit-appearance:none;
-moz-appearance:none;
appearance:none;
background:#ccc;
border-radius:1em;
transition:.3s ease-out background,.3s ease-out transform
}
.slideshow input[type=radio]:checked{
background:#999;outline:0;transform: translateY(360px) scale(1.3)}
.slideshow-item{
width:100%;
height:360px;
line-height:1.5;
position:absolute;
top:0;
opacity:0;
transition:.3s ease-out opacity}
.slideshow .slideshow-item label{
position:absolute;
top:0;
bottom:0;
width:50%;
display:none;
z-index:88;
cursor:pointer;
color:transparent;
-webkit-touch-callout:none;
-webkit-user-select:none;
-khtml-user-select:none-moz-user-select:none;-ms-user-select:none;user-select:none}.slideshow .slideshow-item label:after{display:block;content:'\25B6';font-size:2em;color:#fff;position:absolute;top:50%;right:10px;margin-top:-.5em}.slideshow .slideshow-item label.previous{left:0;display:block}.slideshow .slideshow-item label.previous:after{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);transform:scaleX(-1);right:auto;left:10px}.slideshow .slideshow-item label.next{left:50%;display:block}.slideshow input[type=radio]:checked+.slideshow-item{opacity:1}
<div class="page">
<div class="slideshow">
<input type="radio" name="slide" id="item-1" checked="checked" />
<div class="slideshow-item">
<img src="http://lorempixel.com/640/360/sports/1" />
<label for="item-3" class="previous">Go to slide 3</label>
<label for="item-2" class="next">Go to slide 2</label>
</div>
<input type="radio" name="slide" id="item-2" />
<div class="slideshow-item">
<img src="http://lorempixel.com/640/360/sports/2" />
<label for="item-1" class="previous">Go to slide 1</label>
<label for="item-3" class="next">Go to slide 3</label>
</div>
<input type="radio" name="slide" id="item-3" />
<div class="slideshow-item">
<img src="http://lorempixel.com/640/360/sports/3" />
<label for="item-2" class="previous">Go to slide 2</label>
<label for="item-1" class="next">Go to slide 1</label>
</div>
</div>
<p>By #joggink | View on github</p>
</div>

css html based slider / show part of next slide on hover

Been trying for a longer time now to adjust the effect on the slider below. The effect I am trying to create is that when you hover the right or left side it shows a bit of the next or previous slide.
Example: when the active slide is slide 1 and you hover the left side (say 10% of the total slide) it should show a piece of the previous slide and when hovering the right side of slide 1 (again 10%) it should show a bit of the next slide.
I am not completely sure whether this effect is possible in CSS/HTML, however it might work with a hover state. But if it should be possible, one of you should probably know that :)
/* Slider wrapper*/
.css-slider-wrapper {
display: block;
background: #FFF;
overflow: hidden;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
/* Slider */
.slider {
width: 100%;
height: 100%;
background: red;
position: absolute;
left: 0;
top: 0;
opacity: 1;
z-index: 0;
display: flex;
display: -webkit-flex;
display: -ms-flexbox;
flex-direction: row;
flex-wrap: wrap;
-webkit-flex-align: center;
-webkit-align-items: center;
align-items: center;
justify-content: center;
align-content: center;
-webkit-transition: -webkit-transform 1600ms;
transition: -webkit-transform 1600ms, transform 1600ms;
-webkit-transform: scale(1);
transform: scale(1);
}
/* each slide background color */
.slide1 {
background: #00bcd7;
left: 0;
}
.slide2 {
background: #009788;
left: 100%
}
.slide3 {
background: #ff5608;
left: 200%
}
.slide4 {
background: #607d8d;
left: 300%;
}
.slider > div {
text-align: center;
}
/* Slider inner content */
.slider h2 {
color: #FFF;
font-weight: 900;
text-transform: uppercase;
font-size: 45px;
line-height: 120%;
opacity: 0;
-webkit-transform: translateX(500px);
transform: translateX(500px);
}
.slider .button {
color: #FFF;
padding: 5px 50px;
background: rgba(255,255,255,0.3);
text-decoration: none;
opacity: 0;
font-size: 15px;
line-height: 30px;
display: inline-block;
-webkit-transform: translateX(-500px);
transform: translateX(-500px);
}
.slider h2, .slider .button {
-webkit-transition: opacity 800ms, -webkit-transform 800ms;
transition: transform 800ms, opacity 800ms;
-webkit-transition-delay: 1s; /* Safari */
transition-delay: 1s;
}
/* Next and previous button */
.control {
position: absolute;
top: 50%;
width: 50px;
height: 50px;
margin-top: -25px;
z-index: 55;
}
.control label {
z-index: 0;
display: none;
text-align: center;
line-height: 50px;
font-size: 50px;
color: #FFF;
cursor: pointer;
opacity: 0.2;
}
.control label:hover {
opacity: 0.5;
}
.next {
right: 1%;
}
.previous {
left: 1%;
}
/* Slider pagination */
.slider-pagination {
position: absolute;
bottom: 20px;
width: 100%;
left: 0;
text-align: center;
z-index: 1000;
}
.slider-pagination label {
width: 10px;
height: 10px;
border-radius: 50%;
display: inline-block;
background: rgba(255,255,255,0.2);
margin: 0 2px;
border: solid 1px rgba(255,255,255,0.4);
cursor: pointer;
}
/* Slider control active css */
.slide-radio1:checked ~ .next .numb2,
.slide-radio2:checked ~ .next .numb3,
.slide-radio3:checked ~ .next .numb4,
.slide-radio2:checked ~ .previous .numb1,
.slide-radio3:checked ~ .previous .numb2,
.slide-radio4:checked ~ .previous .numb3 {
display: block;
z-index: 1
}
/* Slider pagination active css */
.slide-radio1:checked ~ .slider-pagination .page1,
.slide-radio2:checked ~ .slider-pagination .page2,
.slide-radio3:checked ~ .slider-pagination .page3,
.slide-radio4:checked ~ .slider-pagination .page4 {
background: rgba(255,255,255,1)
}
/* css for sliding effect when you click on control button*/
.slide-radio1:checked ~ .slider {
-webkit-transform: translateX(0%);
transform: translateX(0%);
}
.slide-radio2:checked ~ .slider {
-webkit-transform: translateX(-100%);
transform: translateX(-100%);
}
.slide-radio3:checked ~ .slider {
-webkit-transform: translateX(-200%);
transform: translateX(-200%);
}
.slide-radio4:checked ~ .slider {
-webkit-transform: translateX(-300%);
transform: translateX(-300%);
}
.slide-radio1:checked ~ .slide1 h2,
.slide-radio2:checked ~ .slide2 h2,
.slide-radio3:checked ~ .slide3 h2,
.slide-radio4:checked ~ .slide4 h2,
.slide-radio1:checked ~ .slide1 .button,
.slide-radio2:checked ~ .slide2 .button,
.slide-radio3:checked ~ .slide3 .button,
.slide-radio4:checked ~ .slide4 .button {
-webkit-transform: translateX(0);
transform: translateX(0);
opacity: 1
}
#media only screen and (max-width: 767px) {
.slider h2 {
font-size: 20px;
}
.slider > div {
padding: 0 2%
}
.control label {
font-size: 35px;
}
.slider .button {
padding: 0 30px;
}
<div class="css-slider-wrapper">
<input type="radio" name="slider" class="slide-radio1" checked id="slider_1">
<input type="radio" name="slider" class="slide-radio2" id="slider_2">
<input type="radio" name="slider" class="slide-radio3" id="slider_3">
<input type="radio" name="slider" class="slide-radio4" id="slider_4">
<div class="slider-pagination">
<label for="slider_1" class="page1"></label>
<label for="slider_2" class="page2"></label>
<label for="slider_3" class="page3"></label>
<label for="slider_4" class="page4"></label>
</div>
<div class="next control">
<label for="slider_1" class="numb1"><i class="fa fa-arrow-circle-right"></i></label>
<label for="slider_2" class="numb2"><i class="fa fa-arrow-circle-right"></i></label>
<label for="slider_3" class="numb3"><i class="fa fa-arrow-circle-right"></i></label>
<label for="slider_4" class="numb4"><i class="fa fa-arrow-circle-right"></i></label>
</div>
<div class="previous control">
<label for="slider_1" class="numb1"><i class="fa fa-arrow-circle-left"></i></label>
<label for="slider_2" class="numb2"><i class="fa fa-arrow-circle-left"></i></label>
<label for="slider_3" class="numb3"><i class="fa fa-arrow-circle-left"></i></label>
<label for="slider_4" class="numb4"><i class="fa fa-arrow-circle-left"></i></label>
</div>
<div class="slider slide1">
<div>
<img src="http://fillmurray.com/801/450"></img>
</div>
</div>
<div class="slider slide2">
<div>
<img src="http://fillmurray.com/801/450"></img>
</div>
</div>
<div class="slider slide3">
<div>
<img src="http://fillmurray.com/801/450"></img>
</div>
</div>
<div class="slider slide4">
<div>
<img src="http://fillmurray.com/801/450"></img>
</div>
</div>
</div>
You were almost there. There were a few transitions missing only:
.slide-radio1:checked ~ .control.previous {
display: none;
}
.slide-radio1:checked ~ .control.next:hover ~.slider {
-webkit-transform: translateX(-10%);
transform: translateX(-10%);
}
.slide-radio2:checked ~ .control.next:hover ~.slider {
-webkit-transform: translateX(-110%);
transform: translateX(-110%);
}
.slide-radio2:checked ~ .control.previous:hover ~.slider {
-webkit-transform: translateX(-90%);
transform: translateX(-90%);
}
.slide-radio3:checked ~ .control.next:hover ~.slider {
-webkit-transform: translateX(-210%);
transform: translateX(-210%);
}
.slide-radio3:checked ~ .control.previous:hover ~.slider {
-webkit-transform: translateX(-190%);
transform: translateX(-190%);
}
.slide-radio4:checked ~ .control.next {
display: none;
}
.slide-radio4:checked ~ .control.previous:hover ~.slider {
-webkit-transform: translateX(-290%);
transform: translateX(-290%);
}
.slide-radio1:checked ~ .control .numb1 {
display: inline-block;
}
.slide-radio2:checked ~ .control .numb2 {
display: inline-block;
}
.slide-radio3:checked ~ .control .numb3 {
display: inline-block;
}
.slide-radio4:checked ~ .control .numb4 {
display: inline-block;
}
I also had to change icons with P and N characters. I didn't have those icon fonts.
/* Slider wrapper*/
.css-slider-wrapper {
background: #FFF;
}
/* Slider */
.slider {
width: 100%;
height: 100%;
background: red;
position: absolute;
left: 0;
top: 0;
z-index: 0;
-webkit-transition: -webkit-transform 1600ms;
transition: -webkit-transform 1600ms, transform 1600ms;
-webkit-transform: scale(1);
transform: scale(1);
}
/* each slide background color */
.slide1 {
background: #00bcd7;
left: 0;
}
.slide2 {
background: #009788;
left: 100%
}
.slide3 {
background: #ff5608;
left: 200%
}
.slide4 {
background: #607d8d;
left: 300%;
}
/* Slider inner content */
.slider h2 {
color: #FFF;
font-weight: 900;
text-transform: uppercase;
font-size: 45px;
line-height: 120%;
opacity: 0;
-webkit-transform: translateX(500px);
transform: translateX(500px);
}
.slider img {
height: 100%;
width: 100%;
object-fit: cover;
}
.slider .button {
color: #FFF;
padding: 5px 50px;
background: rgba(255,255,255,0.3);
text-decoration: none;
opacity: 0;
font-size: 15px;
line-height: 30px;
display: inline-block;
-webkit-transform: translateX(-500px);
transform: translateX(-500px);
}
.slider h2, .slider .button {
-webkit-transition: opacity 800ms, -webkit-transform 800ms;
transition: transform 800ms, opacity 800ms;
-webkit-transition-delay: 1s; /* Safari */
transition-delay: 1s;
}
/* Next and previous button */
.control {
position: absolute;
top: 50%;
width: 50px;
height: 50px;
margin-top: -25px;
z-index: 55;
}
.control label {
z-index: 0;
text-align: center;
line-height: 50px;
font-size: 50px;
color: #FFF;
cursor: pointer;
opacity: 0.2;
display: none;
}
.control:hover label {
opacity: 0.5;
}
.next {
right: 1%;
}
.previous {
left: 1%;
}
/* Slider pagination */
.slider-pagination {
position: absolute;
bottom: 20px;
width: 100%;
left: 0;
text-align: center;
z-index: 1000;
}
.slider-pagination label {
width: 10px;
height: 10px;
border-radius: 50%;
display: inline-block;
background: rgba(255,255,255,0.2);
margin: 0 2px;
border: solid 1px rgba(255,255,255,0.4);
cursor: pointer;
}
/* Slider pagination active css */
.slide-radio1:checked ~ .slider-pagination .page1,
.slide-radio2:checked ~ .slider-pagination .page2,
.slide-radio3:checked ~ .slider-pagination .page3,
.slide-radio4:checked ~ .slider-pagination .page4 {
background: rgba(255,255,255,1)
}
/* css for sliding effect when you click on control button*/
.slide-radio1:checked ~ .slider {
-webkit-transform: translateX(0%);
transform: translateX(0%);
}
.slide-radio2:checked ~ .slider {
-webkit-transform: translateX(-100%);
transform: translateX(-100%);
}
.slide-radio3:checked ~ .slider {
-webkit-transform: translateX(-200%);
transform: translateX(-200%);
}
.slide-radio4:checked ~ .slider {
-webkit-transform: translateX(-300%);
transform: translateX(-300%);
}
.slide-radio1:checked ~ .slide1 h2,
.slide-radio2:checked ~ .slide2 h2,
.slide-radio3:checked ~ .slide3 h2,
.slide-radio4:checked ~ .slide4 h2,
.slide-radio1:checked ~ .slide1 .button,
.slide-radio2:checked ~ .slide2 .button,
.slide-radio3:checked ~ .slide3 .button,
.slide-radio4:checked ~ .slide4 .button {
-webkit-transform: translateX(0);
transform: translateX(0);
opacity: 1
}
.slide-radio1:checked ~ .control.previous {
display: none;
}
.slide-radio1:checked ~ .control.next:hover ~.slider {
-webkit-transform: translateX(-10%);
transform: translateX(-10%);
}
.slide-radio2:checked ~ .control.next:hover ~.slider {
-webkit-transform: translateX(-110%);
transform: translateX(-110%);
}
.slide-radio2:checked ~ .control.previous:hover ~.slider {
-webkit-transform: translateX(-90%);
transform: translateX(-90%);
}
.slide-radio3:checked ~ .control.next:hover ~.slider {
-webkit-transform: translateX(-210%);
transform: translateX(-210%);
}
.slide-radio3:checked ~ .control.previous:hover ~.slider {
-webkit-transform: translateX(-190%);
transform: translateX(-190%);
}
.slide-radio4:checked ~ .control.next {
display: none;
}
.slide-radio4:checked ~ .control.previous:hover ~.slider {
-webkit-transform: translateX(-290%);
transform: translateX(-290%);
}
.slide-radio1:checked ~ .control .numb1 {
display: inline-block;
}
.slide-radio2:checked ~ .control .numb2 {
display: inline-block;
}
.slide-radio3:checked ~ .control .numb3 {
display: inline-block;
}
.slide-radio4:checked ~ .control .numb4 {
display: inline-block;
}
<div class="css-slider-wrapper">
<input type="radio" name="slider" class="slide-radio1" checked id="slider_1">
<input type="radio" name="slider" class="slide-radio2" id="slider_2">
<input type="radio" name="slider" class="slide-radio3" id="slider_3">
<input type="radio" name="slider" class="slide-radio4" id="slider_4">
<div class="slider-pagination">
<label for="slider_1" class="page1"></label>
<label for="slider_2" class="page2"></label>
<label for="slider_3" class="page3"></label>
<label for="slider_4" class="page4"></label>
</div>
<div class="control previous">
<label for="slider_1" class="numb2"> P </label>
<label for="slider_2" class="numb3"> P </label>
<label for="slider_3" class="numb4"> P </label>
</div>
<div class="control next">
<label for="slider_2" class="numb1"> N </label>
<label for="slider_3" class="numb2"> N </label>
<label for="slider_4" class="numb3"> N </label>
</div>
<div class="slider slide1">
<img src="http://fillmurray.com/801/450" />
</div>
<div class="slider slide2">
<img src="http://fillmurray.com/800/450" />
</div>
<div class="slider slide3">
<img src="http://fillmurray.com/799/450" />
</div>
<div class="slider slide4">
<img src="http://fillmurray.com/798/450" />
</div>
</div>