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>
Related
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>
Im working on a slider and im burn out, you guys know how it is, working on something so much eventually the brain just cant do it, so im going to leave it for today and ask you if you have an answer for the issue.
So heres my slider on html
.header {
grid-area: header;
border: 1px solid black;
background-color: black;
}
.slideshow {
width: 923px;
height: 500px;
overflow: hidden;
display: block;
margin-left: auto;
margin-right: auto;
}
.slideshow-container {
width: 4615px;
font-size: 0;
transition: 1s ease;
height: 500px;
overflow: hidden;
}
.slideshow-container:hover {
animation-play-state: paused;
}
.slide {
animation: slide 24s ease infinite;
}
.img1 {
width: 923px;
height: auto;
object-fit: cover;
}
.img2 {
width: 923px;
height: auto;
object-fit: cover;
}
.img3 {
width: 923px;
height: auto;
object-fit: cover;
}
.img4 {
width: 923px;
height: auto;
object-fit: cover;
}
.img5 {
width: 923px;
height: auto;
object-fit: cover;
}
#keyframes slide {
10% {
margin-left: 0px;
}
20% {
margin-left: -923px;
}
30% {
margin-left: -923px;
}
40% {
margin-left: -1846px;
}
50% {
margin-left: -1846px;
}
60% {
margin-left: -2769px;
}
70% {
margin-left: -2769px;
}
80% {
margin-left: -3692px;
}
90% {
margin-left: -3692px;
}
}
.dot1 {
height: 25px;
width: 25px;
background-color: white;
border-radius: 50%;
display: inline-block;
position: absolute;
margin-top: 470px;
margin-left: 400px;
z-index: 2;
}
.dot1:hover {
border: 2px solid white;
background-color: black;
}
.dot2 {
height: 25px;
width: 25px;
background-color: white;
border-radius: 50%;
display: inline-block;
position: absolute;
margin-top: 470px;
margin-left: 430px;
z-index: 2;
}
.dot3 {
height: 25px;
width: 25px;
background-color: white;
border-radius: 50%;
display: inline-block;
position: absolute;
margin-top: 470px;
margin-left: 460px;
z-index: 2;
}
.dot4 {
height: 25px;
width: 25px;
background-color: white;
border-radius: 50%;
display: inline-block;
position: absolute;
margin-top: 470px;
margin-left: 490px;
z-index: 2;
}
<div class="header">
<div class="slideshow">
<span class="dot1"></span>
<span class="dot2"></span>
<span class="dot3"></span>
<span class="dot4"></span>
<div class="slideshow-container slide">
<img class="img1" src="https://i.imgur.com/xGMtCkJ.jpg">
<img class="img2" src="https://i.imgur.com/1F5Gtuz.jpg">
<img class="img3" src="https://i.imgur.com/GgikuGI.jpg">
<img class="img4" src="https://i.imgur.com/LlTDfcH.jpg">
<img class="img5" src="https://i.imgur.com/hNLNCgQ.png">
</div>
</div>
</div>
So here is what the slider and keyframes look like
What im looking for is a part of a code that i can include to
.dot1:hover {
border: 2px solid white;
background-color: black;
}
So what i want is that when someone hover's over the first dot the slider goes to the first keyframe or image, and so on with the other dots, if anyone knows a way to make that happen without javascripts and if i can reverse the keyframe animation that would be perfect.
thanks :)
It's possible using CSS:
Here is the snippet for slider using pure css:
.csslider {
display: inline-block;
position: relative;
max-width: 480px;
width: 100%;
margin-top: 10px;
}
.csslider > .cs_anchor {
display: none;
}
.csslider > ul {
position: relative;
z-index: 1;
font-size: 0;
line-height: 0;
margin: 0 auto;
padding: 0;
overflow: hidden;
white-space: nowrap;
}
.csslider > ul > li.img img {
width: 100%;
}
.csslider > ul > li.img {
font-size: 0pt;
-khtml-user-select: none;
-moz-user-select: none;
user-select: none;
}
.csslider > ul > li {
position: relative;
display: inline-block;
width: 100%;
height: 100%;
overflow: hidden;
font-size: 15px;
font-size: initial;
line-height: normal;
white-space: normal;
vertical-align: top;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-transform: translate3d(0,0,0);
-moz-transform: translate3d(0,0,0);
-ms-transform: translate3d(0,0,0);
-o-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
}
.csslider .cs_lnk{
position: absolute;
top: -9999px;
left: -9999px;
font-size: 0pt;
opacity: 0;
filter: alpha(opacity=0);
}
.csslider > .cs_bullets {
position: absolute;
left: 0;
width: 100%;
z-index: 6;
font-size: 0;
line-height: 8pt;
text-align: center;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.csslider > .cs_bullets > div {
margin-left: -50%;
width: 100%;
}
.csslider > .cs_bullets > label {
position: relative;
display: inline-block;
cursor: pointer;
}
.csslider > .cs_description {
z-index: 3;
}
.csslider > ul > li {
position: absolute;
left: 0;
top: 0;
display: inline-block;
opacity: 0;
z-index: 1;
-webkit-transition: opacity 2000ms ease, -webkit-transform 24000ms linear;
-moz-transition: opacity 2000ms ease, -moz-transform 24000ms linear;
-ms-transition: opacity 2000ms ease, -ms-transform 24000ms linear;
-o-transition: opacity 2000ms ease, -o-transform 24000ms linear;
transition: opacity 2000ms ease, transform 24000ms linear;
}
.csslider > ul > li.num0 {
opacity: 0;
-webkit-transform: scale(1.3) translate(-11.53846%, 11.53846%);
-moz-transform: scale(1.3) translate(-11.53846%, 11.53846%);
-ms-transform: scale(1.3) translate(-11.53846%, 11.53846%);
-o-transform: scale(1.3) translate(-11.53846%, 11.53846%);
transform: scale(1.3) translate(-11.53846%, 11.53846%);
}
.csslider > ul > li.num1 {
opacity: 0;
-webkit-transform: scale(1.3) translate(11.53846%, 11.53846%);
-moz-transform: scale(1.3) translate(11.53846%, 11.53846%);
-ms-transform: scale(1.3) translate(11.53846%, 11.53846%);
-o-transform: scale(1.3) translate(11.53846%, 11.53846%);
transform: scale(1.3) translate(11.53846%, 11.53846%);
}
.csslider > ul > li.num2 {
opacity: 0;
-webkit-transform: scale(1.3) translate(-11.53846%, -11.53846%);
-moz-transform: scale(1.3) translate(-11.53846%, -11.53846%);
-ms-transform: scale(1.3) translate(-11.53846%, -11.53846%);
-o-transform: scale(1.3) translate(-11.53846%, -11.53846%);
transform: scale(1.3) translate(-11.53846%, -11.53846%);
}
.csslider > ul > li.num0 {
opacity: 1;
z-index: 2;
}
.csslider > .slide:hover ~ ul > li.num0 {
opacity: 0;
z-index: 1;
}
.csslider > #cs_slide1_0:hover ~ ul > li.num0,.csslider > #cs_slide1_1:hover ~ ul > li.num1,.csslider > #cs_slide1_2:hover ~ ul > li.num2 {
opacity: 1;
-webkit-transform: scale(1) translate(0, 0);
-moz-transform: scale(1) translate(0, 0);
-ms-transform: scale(1) translate(0, 0);
-o-transform: scale(1) translate(0, 0);
transform: scale(1) translate(0, 0);
z-index: 2;
}
.csslider > .cs_bullets {
bottom: 5px;
margin-bottom: 5px;
}
.csslider > .cs_bullets > label {
margin: 0 6px;
padding: 9px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: #000;
background-color: rgba(0,0,0,0.6);
}
.csslider > .cs_bullets > label.num0 {
background-color: #E34B64;
}
.csslider > .slide:hover ~ .cs_bullets > label {
/* Fallback for web browsers that doesn't support RGBa */
background: #000;
background-color: rgba(0,0,0,0.6);
}
.csslider > #cs_slide1_0:hover ~ .cs_bullets > label.num0,
.csslider > #cs_slide1_1:hover ~ .cs_bullets > label.num1,
.csslider > #cs_slide1_2:hover ~ .cs_bullets > label.num2 {
background-color: #E34B64;
}
<!DOCTYPE html>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Poor+Story" rel="stylesheet">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>
</title>
</head>
<body>
<div class='csslider autoplay '>
<input name="cs_anchor1" id='cs_slide1_0' type="radio" class='cs_anchor slide'>
<input name="cs_anchor1" id='cs_slide1_1' type="radio" class='cs_anchor slide'>
<input name="cs_anchor1" id='cs_slide1_2' type="radio" class='cs_anchor slide'>
<input name="cs_anchor1" id='cs_play1' type="radio" class='cs_anchor' hover>
<input name="cs_anchor1" id='cs_pause1' type="radio" class='cs_anchor'>
<ul>
<div style="width: 100%; visibility: hidden; font-size: 0px; line-height: 0;">
<img src="http://cssslider.com/sliders/pen/images/buns.jpg" style="width: 100%;">
</div>
<li class='num0 img'>
<img src='http://cssslider.com/sliders/pen/images/buns.jpg' alt='Buns' title='Buns' />
</li>
<li class='num1 img'>
<img src='http://cssslider.com/sliders/pen/images/buns.jpg' alt='Croissant' title='Croissant' />
</li>
<li class='num2 img'>
<img src='http://cssslider.com/sliders/pen/images/buns.jpg' alt='Lemon pie' title='Lemon pie' />
</li>
</ul>
<div class='cs_bullets'>
<label class='num0' for='cs_slide1_0'>
<span class='cs_point'></span>
</label>
<label class='num1' for='cs_slide1_1'>
<span class='cs_point'></span>
</label>
<label class='num2' for='cs_slide1_2'>
<span class='cs_point'></span>
</label>
</div>
</div>
</body>
</html>
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>
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>
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;
}