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>
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>
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>
Can someone help me figure out how to add my upload image code and text input to the page 1 right below the Header and paragraph. When I add it, it stays stuck at the top of the page. I have the code below and an image of the issue. We are supposed to add on different pieces to this web page design for an assignment and I'm new to html so I'm struggling with how to fix this issue.
HTML
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>The Title</title>
<meta name="viewport" content="width=device-width">
<link rel='stylesheet prefetch' href='https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css'>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container">
<div class="st-container">
<input type="radio" name="radio-set" checked="checked" id="st-control-1"/>
Page 1
<input type="radio" name="radio-set" id="st-control-2"/>
Page 2
<input type="radio" name="radio-set" id="st-control-3"/>
Page 3
<input type="radio" name="radio-set" id="st-control-4"/>
Page 4
<input type="radio" name="radio-set" id="st-control-5"/>
Page 5
<div class="st-scroll">
<!-- Placeholder text from http://hipsteripsum.me/ -->
<section class="st-panel" id="st-panel-1">
<div class="st-deco" data-icon=""></div>
<h2>P1</h2>
<p>here is the paragraph.</p>
<p1> Please upload an image/txt.</p>
<div class = "main_container">
<form action="/action_page.php">
<input type="file" name="pic" accept="image/*">
</form>
<input type="text" name="What would you like to create?">
Let's get started!
</center>
</div>
</section>
<section class="st-panel st-color" id="st-panel-2">
<div class="st-deco" data-icon=""></div>
<h2>P2</h2>
<p>Art party readymade beard labore cosby sweater culpa. Art party whatever incididunt, scenester umami polaroid tofu.</p>
</section>
<section class="st-panel" id="st-panel-3">
<div class="st-deco" data-icon=""></div>
<h2>P3</h2>
<p>Sint aute occaecat id vice. Post-ironic pork belly next level godard, id fanny pack williamsburg forage truffaut.</p>
</section>
<section class="st-panel st-color" id="st-panel-4">
<div class="st-deco" data-icon=""></div>
<h2>P4</h2>
<p>Mixtape fap leggings art party, butcher authentic farm-to-table you probably haven't heard of them do labore cosby sweater.</p>
</section>
<section class="st-panel" id="st-panel-5">
<div class="st-deco" data-icon=""></div>
<h2>P5</h2>
<p>Fixie ad odd future polaroid dreamcatcher, nesciunt carles bicycle rights accusamus mcsweeney's mumblecore nulla irony.</p>
</section>
</div><!-- // st-scroll -->
</div><!-- // st-container -->
</div>
</body>
</html>
CSS
#import url('//fonts.googleapis.com/css?family=Josefin+Slab:400,700');
body {
overflow: hidden;
}
/* Main container where upload img and text input is */
.main_container{
margin: auto;
width: 860px;
padding: 20px;
border: 1px solid #000000;
min-height: 400px;
border-top: none;
background: #ffffff;
}
a {
text-decoration: none;
}
.st-container {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
font-family: 'Josefin Slab', 'Myriad Pro', Arial, sans-serif;
}
.st-container > input,
.st-container > a {
position: fixed;
bottom: 0px;
width: 20%;
cursor: pointer;
font-size: 16px;
height: 34px;
line-height: 34px;
}
.st-container > input {
opacity: 0;
z-index: 1000;
}
.st-container > a {
z-index: 10;
font-weight: 700;
background: #e23a6e;
color: #fff;
text-align: center;
text-shadow: 1px 1px 1px rgba(151,24,64,0.2);
}
/* "Fix" for percentage rounding: add a background bar pseudo element with the same color like the labels */
.st-container:before {
content: '';
position: fixed;
width: 100%;
height: 34px;
background: #e23a6e;
z-index: 9;
bottom: 0;
}
#st-control-1, #st-control-1 + a {
left: 0;
}
#st-control-2, #st-control-2 + a {
left: 20%;
}
#st-control-3, #st-control-3 + a {
left: 40%;
}
#st-control-4, #st-control-4 + a {
left: 60%;
}
#st-control-5, #st-control-5 + a {
left: 80%;
}
.st-container > input:checked + a,
.st-container > input:checked:hover + a{
background: #821134;
}
.st-container > input:checked + a:after,
.st-container > input:checked:hover + a:after{
bottom: 100%;
border: solid transparent;
content: '';
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-bottom-color: #821134;
border-width: 20px;
left: 50%;
margin-left: -20px;
}
.st-container > input:hover + a{
background: #AD244F;
}
.st-container > input:hover + a:after {
border-bottom-color: #AD244F;
}
.st-scroll,
.st-panel {
position: relative;
width: 100%;
height: 100%;
}
.st-scroll {
top: 0;
left: 0;
-webkit-transition: all 0.6s ease-in-out;
-moz-transition: all 0.6s ease-in-out;
-o-transition: all 0.6s ease-in-out;
-ms-transition: all 0.6s ease-in-out;
transition: all 0.6s ease-in-out;
/* Let's enforce some hardware acceleration */
-webkit-transform: translate3d(0, 0, 0);
-webkit-backface-visibility: hidden;
}
.st-panel{
background: #fff;
overflow: hidden;
}
#st-control-1:checked ~ .st-scroll {
-webkit-transform: translateY(0%);
-moz-transform: translateY(0%);
-o-transform: translateY(0%);
-ms-transform: translateY(0%);
transform: translateY(0%);
}
#st-control-2:checked ~ .st-scroll {
-webkit-transform: translateY(-100%);
-moz-transform: translateY(-100%);
-o-transform: translateY(-100%);
-ms-transform: translateY(-100%);
transform: translateY(-100%);
}
#st-control-3:checked ~ .st-scroll {
-webkit-transform: translateY(-200%);
-moz-transform: translateY(-200%);
-o-transform: translateY(-200%);
-ms-transform: translateY(-200%);
transform: translateY(-200%);
}
#st-control-4:checked ~ .st-scroll {
-webkit-transform: translateY(-300%);
-moz-transform: translateY(-300%);
-o-transform: translateY(-300%);
-ms-transform: translateY(-300%);
transform: translateY(-300%);
}
#st-control-5:checked ~ .st-scroll {
-webkit-transform: translateY(-400%);
-moz-transform: translateY(-400%);
-o-transform: translateY(-400%);
-ms-transform: translateY(-400%);
transform: translateY(-400%);
}
/* Content elements */
.st-deco{
width: 200px;
height: 200px;
position: absolute;
top: 0px;
left: 50%;
margin-left: -100px;
background: #fa96b5;
-webkit-transform: translateY(-50%) rotate(45deg);
-moz-transform: translateY(-50%) rotate(45deg);
-o-transform: translateY(-50%) rotate(45deg);
-ms-transform: translateY(-50%) rotate(45deg);
transform: translateY(-50%) rotate(45deg);
}
[data-icon]:after {
content: attr(data-icon);
font-family: 'FontAwesome';
color: #fff;
text-shadow: 1px 1px 1px rgba(151,24,64,0.2);
position: absolute;
width: 200px;
height: 200px;
line-height: 200px;
text-align: center;
font-size: 90px;
top: 50%;
left: 50%;
margin: -100px 0 0 -100px;
-webkit-transform: rotate(-45deg) translateY(25%);
-moz-transform: rotate(-45deg) translateY(25%);
-o-transform: rotate(-45deg) translateY(25%);
-ms-transform: rotate(-45deg) translateY(25%);
transform: rotate(-45deg) translateY(25%);
}
.st-panel h2 {
color: #e23a6e;
text-shadow: 1px 1px 1px rgba(151,24,64,0.2);
position: absolute;
font-size: 54px;
font-weight: 900;
width: 80%;
left: 10%;
text-align: center;
line-height: 50px;
margin: -70px 0 0 0;
padding: 0;
top: 50%;
-webkit-backface-visibility: hidden;
}
#st-control-1:checked ~ .st-scroll #st-panel-1 h2,
#st-control-2:checked ~ .st-scroll #st-panel-2 h2,
#st-control-3:checked ~ .st-scroll #st-panel-3 h2,
#st-control-4:checked ~ .st-scroll #st-panel-4 h2,
#st-control-5:checked ~ .st-scroll #st-panel-5 h2{
-webkit-animation: moveDown 0.6s ease-in-out 0.2s backwards;
-moz-animation: moveDown 0.6s ease-in-out 0.2s backwards;
-o-animation: moveDown 0.6s ease-in-out 0.2s backwards;
-ms-animation: moveDown 0.6s ease-in-out 0.2s backwards;
animation: moveDown 0.6s ease-in-out 0.2s backwards;
}
#-webkit-keyframes moveDown{
0% {
-webkit-transform: translateY(-40px);
opacity: 0;
}
100% {
-webkit-transform: translateY(0px);
opacity: 1;
}
}
#-moz-keyframes moveDown{
0% {
-moz-transform: translateY(-40px);
opacity: 0;
}
100% {
-moz-transform: translateY(0px);
opacity: 1;
}
}
#-o-keyframes moveDown{
0% {
-o-transform: translateY(-40px);
opacity: 0;
}
100% {
-o-transform: translateY(0px);
opacity: 1;
}
}
#-ms-keyframes moveDown{
0% {
-ms-transform: translateY(-40px);
opacity: 0;
}
100% {
-ms-transform: translateY(0px);
opacity: 1;
}
}
#keyframes moveDown{
0% {
transform: translateY(-40px);
opacity: 0;
}
100% {
transform: translateY(0px);
opacity: 1;
}
}
.st-panel p {
position: absolute;
text-align: center;
font-size: 16px;
line-height: 22px;
color: #8b8b8b;
z-index: 2;
padding: 0;
width: 50%;
left: 25%;
top: 50%;
margin: 10px 0 0 0;
-webkit-backface-visibility: hidden;
}
#st-control-1:checked ~ .st-scroll #st-panel-1 p,
#st-control-2:checked ~ .st-scroll #st-panel-2 p,
#st-control-3:checked ~ .st-scroll #st-panel-3 p,
#st-control-4:checked ~ .st-scroll #st-panel-4 p,
#st-control-5:checked ~ .st-scroll #st-panel-5 p{
-webkit-animation: moveUp 0.6s ease-in-out 0.2s backwards;
-moz-animation: moveUp 0.6s ease-in-out 0.2s backwards;
-o-animation: moveUp 0.6s ease-in-out 0.2s backwards;
-ms-animation: moveUp 0.6s ease-in-out 0.2s backwards;
animation: moveUp 0.6s ease-in-out 0.2s backwards;
}
#-webkit-keyframes moveUp{
0% {
-webkit-transform: translateY(40px);
opacity: 0;
}
100% {
-webkit-transform: translateY(0px);
opacity: 1;
}
}
#-moz-keyframes moveUp{
0% {
-moz-transform: translateY(40px);
opacity: 0;
}
100% {
-moz-transform: translateY(0px);
opacity: 1;
}
}
#-o-keyframes moveUp{
0% {
-o-transform: translateY(40px);
opacity: 0;
}
100% {
-o-transform: translateY(0px);
opacity: 1;
}
}
#-ms-keyframes moveUp{
0% {
-ms-transform: translateY(40px);
opacity: 0;
}
100% {
-ms-transform: translateY(0px);
opacity: 1;
}
}
#keyframes moveUp{
0% {
transform: translateY(40px);
opacity: 0;
}
100% {
transform: translateY(0px);
opacity: 1;
}
}
/* Colored sections */
.st-color,
.st-deco{
background: #fa96b5;
}
.st-color [data-icon]:after {
color: #fa96b5;
}
.st-color .st-deco {
background: #fff;
}
.st-color h2 {
color: #fff;
text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
}
.st-color p {
color: #fff;
color: rgba(255,255,255,0.8);
}
#media screen and (max-width: 520px) {
.st-panel h2 {
font-size: 42px;
}
.st-panel p {
width: 90%;
left: 5%;
margin-top: 0;
}
.st-container > a {
font-size: 13px;
}
}
#media screen and (max-width: 360px) {
.st-container > a {
font-size: 10px;
}
.st-deco{
width: 120px;
height: 120px;
margin-left: -60px;
}
[data-icon]:after {
font-size: 60px;
-webkit-transform: rotate(-45deg) translateY(15%);
-moz-transform: rotate(-45deg) translateY(15%);
-o-transform: rotate(-45deg) translateY(15%);
-ms-transform: rotate(-45deg) translateY(15%);
transform: rotate(-45deg) translateY(15%);
}
}
Take a look to your HTML, and I've just put your input under new div and added margin to him:
<div style="position: absolute; margin-top: 50%; margin-left: 35%">
And at all it looks like this:
<p>here is the paragraph.</p>
<div style="position: absolute; margin-top: 50%; margin-left: 35%">
<p1> Please upload an image/txt.</p>
<div class = "main_container">
<form action="/action_page.php">
<input type="file" name="pic" accept="image/*">
</form>
<input type="text" name="What would you like to create?">
Let's get started!
</div></div>
Answers above are great. A hint to figuring out these things is right click on the element and select "Inspect" then you can see all the values affecting layout and where in the css they are getting set.
it is understandable when you are new, things such as this may be hard to notice. I may be wrong, however, it is because of something called specificity that your code is not behaving the way it is supposed to.
Your "main_container" class is being affected by its parent div element with the class of "st-container" to which you have positioned in the top left corner. If you were to use the css selector for "main_container" and change its position, its specificity would override the "st-container".
I have a div whose height and width will be dynamic. I'm tring to have an dotted animation border to that div. Problem which i'm facing is animation duration is not relative to the height and width. i.e whatever height and width its animation should be at same speed across all the corners
.dynamic {
position: absolute;
height: 30px;
width: 300px;
overflow: hidden
}
.dynamic::before {
animation: slideDash 2.5s infinite linear;
position: absolute;
content: '';
left: 0;
right: 0;
outline: 1px dashed #fff;
box-shadow: 0 0 0 1px rgb(23, 163, 102);
width: 200%;
}
.dynamic::after {
animation: slideDash 2.5s infinite linear reverse;
position: absolute;
content: '';
right: 0;
bottom: 0;
outline: 1px dashed #fff;
left: 0;
box-shadow: 0 0 0 1px rgb(23, 163, 102);
width: 200%;
}
.dynamic div::before {
animation: slideDashRev 2.5s infinite linear reverse;
position: absolute;
content: '';
top: 0;
bottom: 0;
outline: 1px dashed #fff;
box-shadow: 0 0 0 1px rgb(23, 163, 102);
height: 200%;
}
.dynamic div::after {
animation: slideDashRev 2.5s infinite linear;
position: absolute;
content: '';
top: 0;
bottom: 0;
outline: 1px dashed #fff;
right: 0;
box-shadow: 0 0 0 1px rgb(23, 163, 102);
height: 200%;
}
#keyframes slideDash {
from {
transform: translateX(-50%);
}
to {
transform: translateX(0%);
}
}
#keyframes slideDashRev {
from {
transform: translateY(-50%);
}
to {
transform: translateY(0%);
}
}
<div class="dynamic">
<div></div>
</div>
Just correcting the direction of the animation
.dynamic {
position: relative;
width: 300px;
height: 30px;
overflow: hidden;
color: red;
}
.dynamic .line {
width: 100%;
height: 100%;
display: block;
position: absolute;
}
.dynamic .line:nth-of-type(1) {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
.dynamic .line:nth-of-type(2) {
-webkit-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
margin-left: -164px; /* margin-left=(minus)((height+width)/2)-(border-width) */
}
.dynamic .line:nth-of-type(3) {
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
.dynamic .line:nth-of-type(4) {
-webkit-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
margin-left: 164px; /* margin-left=((height+width)/2)-(border-width) */
}
.dynamic .line:nth-of-type(1) i, .dynamic .line:nth-of-type(3) i {
-webkit-animation: move 2.5s infinite linear reverse;
animation: move 2.5s infinite linear reverse;
}
.dynamic .line:nth-of-type(2) i, .dynamic .line:nth-of-type(4) i {
-webkit-animation: move 2.5s infinite linear;
animation: move 2.5s infinite linear;
}
.dynamic .line i {
left: 0;
top: 0;
width: 200%;
display: block;
position: absolute;
border-bottom: 1px dashed;
}
.dynamic .text {
width: 100%;
line-height: 30px;
display: block;
text-align: center;
position: absolute;
font-size: 18px;
}
#-webkit-keyframes move {
from {
-webkit-transform: translateX(0%);
transform: translateX(0%);
}
to {
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
}
}
#keyframes move {
from {
-webkit-transform: translateX(0%);
transform: translateX(0%);
}
to {
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
}
}
<body>
<div class="dynamic">
<div class="line"><i></i>
</div>
<div class="line"><i></i>
</div>
<div class="line"><i></i>
</div>
<div class="line"><i></i>
</div>
<div class="text">Same Direction!!</div>
</div>
</body>
Try below snippet.
.dynamic {
position: relative;
width: 300px;
height: 30px;
overflow: hidden;
color: green;
}
.dynamic .line {
width: 100%;
height: 100%;
display: block;
position: absolute;
}
.dynamic .line:nth-of-type(1) {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
.dynamic .line:nth-of-type(2) {
-webkit-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
margin-left: -164px;
/* margin-left=(minus)((height+width)/2)-(border-width) */
}
.dynamic .line:nth-of-type(3) {
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
.dynamic .line:nth-of-type(4) {
-webkit-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
margin-left: 164px;
/* margin-left=((height+width)/2)-(border-width) */
}
.dynamic .line i {
left: 0;
top: 0;
width: 200%;
display: block;
position: absolute;
border-bottom: 1px dashed;
-webkit-animation: move 2.5s infinite linear reverse;
animation: move 2.5s infinite linear reverse;
}
.dynamic .text {
width: 100%;
line-height: 30px;
display: block;
text-align: center;
position: absolute;
font-size: 18px;
}
#-webkit-keyframes move {
from {
-webkit-transform: translateX(0%);
transform: translateX(0%);
}
to {
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
}
}
#keyframes move {
from {
-webkit-transform: translateX(0%);
transform: translateX(0%);
}
to {
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
}
}
<body>
<div class="dynamic">
<div class="line"><i></i>
</div>
<div class="line"><i></i>
</div>
<div class="line"><i></i>
</div>
<div class="line"><i></i>
</div>
<div class="text">Some text here</div>
</div>
</body>
.dynamic {
position: absolute;
height: 50px;
width: 50px;
overflow: hidden
}
Having the same dimensions for the height and and width makes the animation speed the same.
Note: You can replace the 50 with any dimension of your choice.