Show Div When Click Check-box Radio - html

As you can see in the title I want to show Divs related to my check-box radio button. I looked for past topics about that and I try to do it with some scripts but I failed. I know Im missing somethings.
What I want to do is; when click on Second button (check-box radio tool 2) I want to open div class row3. and When click on First button (check-box radio tool 1) I want to open div class row2.
Maybe it is so easy but Im new on this stuffs. Any help or sugestion would be great.
Thanks..
/* PRODUCTS AND BUTTONS */
.button {
position: absolute;
bottom: 0%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
background-color: #d8d8d8cc;
color: rgb(0, 0, 0);
font-size: 70%;
width: 70%;
height: 20%;;
border: none;
cursor: pointer;
border-radius: 7px;
text-align: center;
}
.button span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.button span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
.button:hover span {
padding-right: 25px;
}
.button:hover span:after {
opacity: 1;
right: 0;
}
.container2 {
position: relative;
width: 100%;
max-width: 400px;
}
.container2 img {
width: 100%;
height: auto;
border-radius: 10px;
}
.container2 img {
width: 100%;
height: auto;
border-radius: 10px;
}
.column2 {
float: center;
width: 2300%;
padding:8px;
}
.row2 {
width: 80%;
padding:5px;
position: relative;
left: 23%;
bottom: 5%;
margin-top:5%;
}
/* Clearfix (clear floats) */
.row2::after {
content: "";
clear: both;
display: table;
}
.row3 {
width: 80%;
padding:5px;
position: relative;
left: 23%;
bottom: 5%;
margin-top:5%;
}
/* Clearfix (clear floats) */
.row3::after {
content: "";
clear: both;
display: table;
}
*:focus {
outline: 0 !important;
}
/* PRODUCTS AND BUTTONS END */
/* Split the screen in half */
.split {
height: 100%;
width: 50%;
position: fixed;
z-index: 1;
top: 0;
overflow-x: hidden;
padding-top: 20px;
}
/* Control the left side */
.left {
left: 0;
background-color: rgb(240, 240, 240);
}
/* Control the right side */
.right {
right: 0;
background-color: rgb(255, 255, 255);
}
/* If you want the content centered horizontally and vertically */
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.centered2 {
position: fixed;
top: 50%;
left: 55%;
transform: translate(-50%, -50%);
text-align: center;
}
/* Style the image inside the centered container, if needed */
.centered img {
width: 150px;
border-radius: 50%;
}
/* Please ❤ this if you like it! */
#import url('https://fonts.googleapis.com/css?family=Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i&subset=devanagari,latin-ext');
:root {
--white: #ffffff;
--light: #f0eff3;
--black: #000000;
--dark-blue: #ffffff;
--dark-light: #ffffff;
--red: #d8d8d8;
--yellow: #d8d8d8;
--grey: #ecedf3;
}
/* #Primary
================================================== */
body{
width: 100%;
background: var(--dark-blue);
overflow-x: hidden;
font-family: 'Poppins', sans-serif;
font-size: 17px;
line-height: 30px;
-webkit-transition: all 300ms linear;
transition: all 300ms linear;
}
p{
font-family: 'Poppins', sans-serif;
font-size: 17px;
line-height: 30px;
color: var(--white);
letter-spacing: 1px;
font-weight: 500;
-webkit-transition: all 300ms linear;
transition: all 300ms linear;
}
::selection {
color: var(--white);
background-color: var(--black);
}
::-moz-selection {
color: var(--white);
background-color: var(--black);
}
mark{
color: var(--white);
background-color: var(--black);
}
.section {
position: relative;
width: 100%;
}
.over-hide {
overflow: hidden;
}
.z-bigger {
z-index: 100 !important;
}
.background-color{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: var(--dark-blue);
z-index: 1;
-webkit-transition: all 300ms linear;
transition: all 300ms linear;
}
.checkbox:checked ~ .background-color{
background-color: var(--white);
}
[type="checkbox"]:checked,
[type="checkbox"]:not(:checked),
[type="radio"]:checked,
[type="radio"]:not(:checked){
position: absolute;
left: -9999px;
width: 0;
height: 0;
visibility: hidden;
}
.checkbox:checked + label,
.checkbox:not(:checked) + label{
position: relative;
width: 70px;
display: inline-block;
padding: 0;
margin: 0 auto;
text-align: center;
margin: 17px 0;
margin-top: 100px;
height: 6px;
border-radius: 4px;
background-image: linear-gradient(298deg, var(--red), var(--yellow));
z-index: 100 !important;
}
.checkbox:checked + label:before,
.checkbox:not(:checked) + label:before {
position: absolute;
font-family: 'unicons';
cursor: pointer;
top: 17px;
z-index: 2;
font-size: 20px;
line-height: 40px;
text-align: center;
width: 40px;
height: 40px;
border-radius: 50%;
-webkit-transition: all 300ms linear;
transition: all 300ms linear;
}
.checkbox:not(:checked) + label:before {
content: '\eac1';
left: 0;
color: var(--grey);
background-color: var(--dark-light);
}
.checkbox:checked + label:before {
content: '\eb8f';
left: 30px;
color: var(--yellow);
background-color: var(--dark-blue);
}
.checkbox:checked ~ .section .container .row .col-12 p{
color: var(--dark-blue);
}
.checkbox-tools:checked + label,
.checkbox-tools:not(:checked) + label{
position: relative;
padding: 15px;
width: 50px;
float: left;
font-size: 14px;
line-height: 20px;
letter-spacing: 1px;
margin: 0 auto;
margin-left: 5px;
margin-right: 5px;
margin-bottom: 10px;
text-align: center;
border-radius: 7px;
overflow: hidden;
cursor: pointer;
text-transform: uppercase;
color: var(--white);
-webkit-transition: all 300ms linear;
transition: all 300ms linear;
}
.checkbox-tools:not(:checked) + label{
background-color: var(--dark-light);
}
.checkbox-tools:checked + label{
background-color: transparent;
}
.checkbox-tools:not(:checked) + label:hover{
box-shadow: 0 8px 8px 0 rgba(0, 0, 0, 0.2);
}
.checkbox-tools:checked + label::before,
.checkbox-tools:not(:checked) + label::before{
position: absolute;
content: '';
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 4px;
background-image: linear-gradient(298deg, var(--red), var(--yellow));
z-index: -1;
}
.checkbox-tools:checked + label .uil,
.checkbox-tools:not(:checked) + label .uil{
font-size: 24px;
line-height: 24px;
display: block;
padding-bottom: 10px;
}
.checkbox:checked ~ .section .container .row .col-12 .checkbox-tools:not(:checked) + label{
background-color: var(--light);
color: var(--dark-blue);
box-shadow: 0 1x 4px 0 rgba(0, 0, 0, 0.05);
}
.checkbox-budget:checked + label,
.checkbox-budget:not(:checked) + label{
position: relative;
display: inline-block;
padding: 0;
padding-top: 20px;
padding-bottom: 20px;
width: 260px;
font-size: 52px;
line-height: 52px;
font-weight: 700;
letter-spacing: 1px;
margin: 0 auto;
margin-left: 5px;
margin-right: 5px;
margin-bottom: 10px;
text-align: center;
border-radius: 4px;
overflow: hidden;
cursor: pointer;
text-transform: uppercase;
-webkit-transition: all 300ms linear;
transition: all 300ms linear;
-webkit-text-stroke: 1px var(--white);
text-stroke: 1px var(--white);
-webkit-text-fill-color: transparent;
text-fill-color: transparent;
color: transparent;
}
.checkbox-budget:not(:checked) + label{
background-color: var(--dark-light);
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
}
.checkbox-budget:checked + label{
background-color: transparent;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.checkbox-budget:not(:checked) + label:hover{
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.checkbox-budget:checked + label::before,
.checkbox-budget:not(:checked) + label::before{
position: absolute;
content: '';
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 4px;
background-image: linear-gradient(138deg, var(--red), var(--yellow));
z-index: -1;
}
.checkbox-budget:checked + label span,
.checkbox-budget:not(:checked) + label span{
position: relative;
display: block;
}
.checkbox-budget:checked + label span::before,
.checkbox-budget:not(:checked) + label span::before{
position: absolute;
content: attr(data-hover);
top: 0;
left: 0;
width: 100%;
overflow: hidden;
-webkit-text-stroke: transparent;
text-stroke: transparent;
-webkit-text-fill-color: var(--white);
text-fill-color: var(--white);
color: var(--white);
-webkit-transition: max-height 0.3s;
-moz-transition: max-height 0.3s;
transition: max-height 0.3s;
}
.checkbox-budget:not(:checked) + label span::before{
max-height: 0;
}
.checkbox-budget:checked + label span::before{
max-height: 100%;
}
.checkbox:checked ~ .section .container .row .col-xl-10 .checkbox-budget:not(:checked) + label{
background-color: var(--light);
-webkit-text-stroke: 1px var(--dark-blue);
text-stroke: 1px var(--dark-blue);
box-shadow: 0 1x 4px 0 rgba(0, 0, 0, 0.05);
}
.checkbox-booking:checked + label,
.checkbox-booking:not(:checked) + label{
position: relative;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
align-items: center;
-webkit-justify-content: center;
-moz-justify-content: center;
-ms-justify-content: center;
justify-content: center;
-ms-flex-pack: center;
text-align: center;
padding: 0;
padding: 6px 25px;
font-size: 14px;
line-height: 30px;
letter-spacing: 1px;
margin: 0 auto;
margin-left: 6px;
margin-right: 6px;
margin-bottom: 16px;
text-align: center;
border-radius: 4px;
cursor: pointer;
color: var(--white);
text-transform: uppercase;
background-color: var(--dark-light);
-webkit-transition: all 300ms linear;
transition: all 300ms linear;
}
.checkbox-booking:not(:checked) + label::before{
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
}
.checkbox-booking:checked + label::before{
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.checkbox-booking:not(:checked) + label:hover::before{
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.checkbox-booking:checked + label::before,
.checkbox-booking:not(:checked) + label::before{
position: absolute;
content: '';
top: -2px;
left: -2px;
width: calc(100% + 4px);
height: calc(100% + 4px);
border-radius: 4px;
z-index: -2;
background-image: linear-gradient(138deg, var(--red), var(--yellow));
-webkit-transition: all 300ms linear;
transition: all 300ms linear;
}
.checkbox-booking:not(:checked) + label::before{
top: -1px;
left: -1px;
width: calc(100% + 2px);
height: calc(100% + 2px);
}
.checkbox-booking:checked + label::after,
.checkbox-booking:not(:checked) + label::after{
position: absolute;
content: '';
top: -2px;
left: -2px;
width: calc(100% + 4px);
height: calc(100% + 4px);
border-radius: 4px;
z-index: -2;
background-color: var(--dark-light);
-webkit-transition: all 300ms linear;
transition: all 300ms linear;
}
.checkbox-booking:checked + label::after{
opacity: 0;
}
.checkbox-booking:checked + label .uil,
.checkbox-booking:not(:checked) + label .uil{
font-size: 20px;
}
.checkbox-booking:checked + label .text,
.checkbox-booking:not(:checked) + label .text{
position: relative;
display: inline-block;
-webkit-transition: opacity 300ms linear;
transition: opacity 300ms linear;
}
.checkbox-booking:checked + label .text{
opacity: 0.6;
}
.checkbox-booking:checked + label .text::after,
.checkbox-booking:not(:checked) + label .text::after{
position: absolute;
content: '';
width: 0;
left: 0;
top: 50%;
margin-top: -1px;
height: 2px;
background-image: linear-gradient(138deg, var(--red), var(--yellow));
z-index: 1;
-webkit-transition: all 300ms linear;
transition: all 300ms linear;
}
.checkbox-booking:not(:checked) + label .text::after{
width: 0;
}
.checkbox-booking:checked + label .text::after{
width: 100%;
}
.checkbox:checked ~ .section .container .row .col-12 .checkbox-booking:not(:checked) + label,
.checkbox:checked ~ .section .container .row .col-12 .checkbox-booking:checked + label{
background-color: var(--light);
color: var(--dark-blue);
}
.checkbox:checked ~ .section .container .row .col-12 .checkbox-booking:checked + label::after,
.checkbox:checked ~ .section .container .row .col-12 .checkbox-booking:not(:checked) + label::after{
background-color: var(--light);
}
.link-to-page {
position: fixed;
top: 30px;
right: 30px;
z-index: 20000;
cursor: pointer;
width: 50px;
}
.link-to-page img{
width: 100%;
height: auto;
display: block;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="main.css" />
<link rel="stylesheet" href="main.js" />
<title>REXIN 3D-AR DEMO</title>
<style>
</style>
</head>
<body>
<div class="split left">
</div>
<div class="split right">
<div class="centered2">
<div class="section over-hide z-bigger">
<input class="checkbox" type="checkbox" name="general" id="general">
<div class="section over-hide z-bigger">
<div class="container pb-5">
<div class="row justify-content-center pb-5">
<div class="col-12 pb-5">
<input class="checkbox-tools" type="radio" name="tools" id="tool-1" checked>
<label class="for-checkbox-tools" for="tool-1">
<img src="https://upload.wikimedia.org/wikipedia/commons/c/c0/Location_dot_black.svg" width="100%" height="100%">
</label>
<br>
<input class="checkbox-tools" type="radio" name="tools" id="tool-2">
<label class="for-checkbox-tools" for="tool-2">
<img src="https://upload.wikimedia.org/wikipedia/commons/c/c0/Location_dot_black.svg" width="100%" height="100%">
</label>
<br>
<input class="checkbox-tools" type="radio" name="tools" id="tool-3">
<label class="for-checkbox-tools" for="tool-3">
<img src="https://upload.wikimedia.org/wikipedia/commons/c/c0/Location_dot_black.svg" width="100%" height="100%">
</label>
<br>
<input class="checkbox-tools" type="radio" name="tools" id="tool-4">
<label class="for-checkbox-tools" for="tool-4">
<img src="https://upload.wikimedia.org/wikipedia/commons/c/c0/Location_dot_black.svg" width="100%" height="100%">
</label>
<br>
<input class="checkbox-tools" type="radio" name="tools" id="tool-5">
<label class="for-checkbox-tools" for="tool-5">
<img src="https://upload.wikimedia.org/wikipedia/commons/c/c0/Location_dot_black.svg" width="100%" height="100%">
</label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row2">
<div class="column2">
<div class="container2">
<img src="Assets/photos/terrassen.jpg" alt="Snow" style="width:100%">
<a href="terrassendach.html"> <button class="button" style="vertical-align:top">
<span>Terrassendach </span></button></a>
</div>
</div>
<div class="column2">
<div class="container2">
<img src="Assets/photos/pergolen.jpg" alt="Snow" style="width:100%">
<a href="pergolen.html"> <button class="button" style="vertical-align:top">
<span>Pergolen </span></button></a>
</div>
</div>
<div class="column2">
<div class="container2">
<img src="Assets/photos/carport.jpg" alt="Snow" style="width:100%">
<a href="carport.html"> <button class="button" style="vertical-align:top">
<span>Carport </span></button></a>
</div>
</div>
<div class="column2">
<div class="container2">
<img src="Assets/photos/Vordächer.jpg" alt="Snow" style="width:100%">
<a href="vordacher.html"> <button class="button" style="vertical-align:top">
<span>Vordächer </span></button></a>
</div>
</div>
</div>
<div class="row3">
<div class="column2">
<div class="container2">
<img src="Assets/photos/terrassen.jpg" alt="Snow" style="width:100%">
<a href="terrassendach.html"> <button class="button" style="vertical-align:top">
<span>Terrassendach </span></button></a>
</div>
</div>
<div class="column2">
<div class="container2">
<img src="Assets/photos/pergolen.jpg" alt="Snow" style="width:100%">
<a href="pergolen.html"> <button class="button" style="vertical-align:top">
<span>Pergolen </span></button></a>
</div>
</div>
<div class="column2">
<div class="container2">
<img src="Assets/photos/carport.jpg" alt="Snow" style="width:100%">
<a href="carport.html"> <button class="button" style="vertical-align:top">
<span>Carport </span></button></a>
</div>
</div>
<div class="column2">
<div class="container2">
<img src="Assets/photos/Vordächer.jpg" alt="Snow" style="width:100%">
<a href="vordacher.html"> <button class="button" style="vertical-align:top">
<span>Vordächer </span></button></a>
</div>
</div>
</div>
</div>
</body>

Try this! (Run code snippet to see)
Codepen: https://codepen.io/dhanushbadge/pen/kICBu
Made by: #Dhanush Badge
function show1(){
document.getElementById('div1').style.display ='none';
}
function show2(){
document.getElementById('div1').style.display = 'block';
}
body {
font-family: arial;
}
.hide {
display: none;
}
p {
font-weight: bold;
}
<p>How many check boxes do you want when clicked on a radio button?</p>
<input type="radio" name="tab" value="igotnone" onclick="show1();" />
None
<input type="radio" name="tab" value="igottwo" onclick="show2();" />
Two
<div id="div1" class="hide">
<hr><p>Okay Cool! Here are those two...</p>
<input type="checkbox" value="Yes" name="one">
One
<input type="checkbox" value="Yes" name="two">
Two
</div>

Related

Animation when hovering over a button

I am trying to make some animated effect by adding a rectangle that expands over the button when the button (not the rectangle since it's set to width: 0px;) is hovered over by the user. Though, I don't really know how to do that, so I'm blocked.
So:
There's a button.
There's a rectangle somewhere.
The rectangle is 0px width.
I want the rectangle to grow from 0 to 200px width when the button is hovered. NOT the button.
I accept javascript solutions but only like real basic ones cause I'm a beginner, I won't understand javascript if it's not explained to me.
For the moment, here's my code:
HTML:
<div class="flex-container">
<div class="sidebar">
<button style="margin-top: 100px;" onclick="Accueil()"><div style="z-index: 2;">Accueil</div></button>
<div class="rectangle" name="acc" style="top: 100px;"></div>
<button onclick="Thés()"><div style="z-index: 2;">Thés</div></button>
<div class="rectangle" name="the" style="top: 100px;"></div>
<button onclick="Tisanes()"><div style="z-index: 2;">Tisanes</div></button>
<div class="rectangle" name="tis" style="top: 100px;"></div>
<button onclick="Théières()"><div style="z-index: 2;">Théières</div></button>
<div class="rectangle" name="thei" style="top: 100px;"></div>
</div>
CSS:
.sidebar > button {
margin: 20px; /* marge de 30px entre les boutons */
width: 200px;
height: 60px;
max-height: 60px !important;
max-width: 200px !important;
background-color: #F5FAD2;
text-align: center;
font-size: 24px;
border-radius: 7%;
border: none;
transition-duration: 0.4s;
cursor: pointer;
color: #404040;
position: relative;
}
.rectangle {
width: 0px;
height: 60px;
color: rgba(255, 255, 255, 0.144);
border-radius: 7%;
border: none;
transition: width 1.1s ease 0s;
transition-timing-function: ease;
transition-delay: 0s;
position: absolute;
z-index: 1;
}
.rectangle button:hover {
width: 200px;
}
Thanks.
<button> Button </button>
button{
transition:0.2s;
}
button:hover{
width:200px
}
You can add the transform property in the button CSS class. This will work to increase the size of the rectangle. You can adjust the value inside the scale to get the desired size when hovered. Copy the CSS & HTML codes below to have that working.
CSS:
.sidebar>button {
margin: 20px;
/* marge de 30px entre les boutons */
width: 200px;
height: 60px;
max-height: 60px !important;
max-width: 200px !important;
background-color: #F5FAD2;
text-align: center;
font-size: 24px;
border-radius: 7%;
border: none;
transition-duration: 0.4s;
cursor: pointer;
color: #404040;
position: relative;
}
.btn:hover {
width: 300px;
transform: scale(1.3) perspective(0.4px);
}
.rectangle {
color: rgba(255, 255, 255, 0.144);
border-radius: 7%;
border: none;
position: absolute;
z-index: 1;
}
HTML:
<div class="flex-container">
<div class="sidebar">
<button style="margin-top: 100px;" class="btn">
<div style="z-index: 2;">Accueil</div>
</button>
<div class="rectangle" name="acc" style="top: 100px;"></div>
<button class="btn">
<div style="z-index: 2;">Thés</div>
</button>
<div class="rectangle" name="the" style="top: 100px;"></div>
<button class="btn">
<div style="z-index: 2;">Tisanes</div>
</button>
<div class="rectangle" name="tis" style="top: 100px;"></div>
<button class="btn">
<div style="z-index: 2;">Théières</div>
</button>
<div class="rectangle" name="thei" style="top: 100px;"></div>
</div>
</div>
Hope this solution helps you!
Maybe it will be useful to you
.rectangle-out {
display: inline-block;
vertical-align: middle;
-webkit-transform: perspective(1px) translateZ(0);
transform: perspective(1px) translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
position: relative;
background: #e1e1e1;
-webkit-transition-property: color;
transition-property: color;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
padding:20px;
color:#000;
text-decoration: none;
}
.rectangle-out:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #2098D1;
-webkit-transform: scale(0);
transform: scale(0);
-webkit-transition-property: transform;
transition-property: transform;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-timing-function: ease-out;
transition-timing-function: ease-out;
}
.rectangle-out:hover, .rectangle-out:focus, .rectangle-out:active {
color: white;
}
.rectangle-out:hover:before, .rectangle-out:focus:before, .rectangle-out:active:before {
-webkit-transform: scale(1);
transform: scale(1);
}
<a class="rectangle-out" href="#">Rectangle Out</a>
Maybe it will be useful to you.
visit my GitHub page. my website total source code here. many Animation when hovering over a button
here.
https://github.com/jacksonkasi0/mhibuddy
(or) visit my website: https://mahibuddy.me
(or)
HTML:
<div class="lo">
<ul>
<li>
<a href="./love/love.html" target="_blank">
<i class="fa fa-heart"></i>
</a>
</li>
</ul>
</div>
CSS:
.lo ul {
margin: 0;
padding: 0;
display: flex;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);}
.lo > ul > li {
list-style: none;
margin: 0 15px;}
.lo > ul > li > a {
position: relative;
display: block;
width: 60px;
height: 60px;
text-align: center;
line-height: 63px;
background: #333;
border-radius: 50%;
font-size: 30px;
color: #666;
transition: 0.5s;}
.lo>ul>li>a :hover{
position: relative;
display: block;
width: 60px;
height: 60px;
text-align: center;
line-height: 63px;
background: rgb(255, 255, 255);
border-radius: 50%;
font-size: 30px;
/* color: #666; */
transition: 0.3s;}
.lo > ul > li > a::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
background: #ff05de;
transition: .5s;
transform: scale(.9);
z-index: -1;}
.lo > ul > li > a:hover::before {
transform: scale(1.1);
box-shadow: 0 0 15px #ff6e9e;}
.lo > ul > li > a:hover {
color: #ff1058;
box-shadow: 0 0 5px #ff1088;
text-shadow: 0 0 5px #ff1044;}
I think I have what you are looking for now
.flex-container {
display: flex;
flex-direction: row;
justify-content: center;
}
.rectangle {
display: none;
}
.button {
width: 200px;
height: 60px;
background-color: #F5FAD2;
text-align: center;
font-size: 24px;
border-radius: 7%;
border: none;
transition-duration: 0.4s;
cursor: pointer;
color: #404040;
position: relative;
margin-right: 20px;
}
.button:hover + .rectangle {
display: block;
width: 200px;
}
<div style="text-align:center" class="flex-container">
<div class = "button">Accueil</div>
<div class="rectangle">test</div>
<div class = "button">Thés</div>
<div class="rectangle">test</div>
<div class = "button">Tisanes</div>
<div class="rectangle">test</div>
<div class = "button">Théières</div>
<div class="rectangle">test</div>
</div>
You can checkout the fiddle I made with this info here: https://jsfiddle.net/mbmarketing4you/j92mgsy6/46/
You have to make the "rectangle" a child of the button in order for the hover effect to work.

label is not floating to the top

I want to have the textfield just like gmail has right now. I mean when we focus on the text field, the label or placeholder goes to the top exactly at the top border line of its text field with no border line on the background of the label only. I tried but could not make it happen and i found the code in internet which did not work either. Here is what the code is
.FieldWrapper input[type="text"] {
box-sizing: border-box;
width: 100%;
height: calc(3em + 2px);
margin: 0 0 1em;
padding: 1em;
border: 1px solid #ccc;
background: #fff;
resize: none;
outline: none;
}
.FieldWrapper input[type="text"]:focus {
border-color: #00bafa;
}
.FieldWrapper input[type="text"]:focus+label[placeholder]:before {
color: #00bafa;
}
.FieldWrapper input[type="text"]:focus+label[placeholder]:before,
.FieldWrapper input[type="text"]:valid+label[placeholder]:before {
transition-duration: 0.2s;
-webkit-transform: translate(0, -1.5em) scale(0.9, 0.9);
transform: translate(0, -1.5em) scale(0.9, 0.9);
}
.FieldWrapper input[type="text"]:invalid+label[placeholder][alt]:before {
content: attr(alt);
}
.FieldWrapper input[type="text"]+label[placeholder] {
display: block;
pointer-events: none;
line-height: 1.25em;
margin-top: calc(-1em - 2px);
margin-bottom: calc((3em - 1em) + 2px);
}
.FieldWrapper input[type="text"]+label[placeholder]:before {
content: attr(placeholder);
display: inline-block;
margin: 0 calc(1em + 2px);
padding: 0 2px;
color: #898989;
white-space: nowrap;
transition: 0.3s ease-in-out;
background-image: linear-gradient(to bottom, #fff, #fff);
background-size: 100% 5px;
background-repeat: no-repeat;
background-position: center;
}
<div class="FieldWrapper">
<input type='text' name="name" />
<label alt="field name" placeholder="field name" />
</div>
This is what exactly i was expecting
Try this:
.input-container {
position: relative;
font-family: Arial;
}
.input-container input {
height: 32px;
line-height: 24px;
border-radius: 8px;
border: 1px solid #dcdcdc;
min-width: 300px;
padding: 4px 8px;
transition: all .2s ease;
}
.input-container label {
position: absolute;
top: 12px;
left: 4px;
background-color: #fff;
padding: 0 4px;
font-size: 14px;
pointer-events: none;
transition: all .2s ease;
}
.input-container input:focus {
outline: none;
border: 1px solid #3f51b5;
}
.input-container input:valid + label,
.input-container input:focus + label {
top: -8px;
color: #3f51b5;
}
<div class="input-container">
<input id="my-input" type="text" required>
<label for="my-input">My input label</label>
</div>

The second text in <span> goes to another line

How do I display "Confirm Password" in a single line ?
I add an <span id="confirm">Confirm Password</span> and I did this, doesn't work:
#confirm {
display: inline;
}
* {
margin: 0px;
padding: 0px;
}
body {
background-color: Royalblue; /*#f0f0f0;*/
}
.head {
text-align: center;
border: 1px solid #B0C4DE;
border-bottom: none;
border-radius: 10px 10px 0px 0px;
padding: 20px;
background: rgba(0, 250, 0, 0);
color: #FFFACD;
font-family: 'Cinzel', sans-serif;
font-size:30px;
}
.content {
position:relative;
top:8px;
width: 30%;
margin: 50px
auto 0px;
}
form {
position: relative;
margin-top: 0;
margin-left: 0;
width: 89%;
height: 300px;
padding: 20px;
border: 1px solid #B0C4DE;
background: rgba(0, 250, 0, 0);
border-radius: 0px 0px 10px 10px;
}
label {
position: relative;
font-family: 'Montserrat', sans-serif;
font-size: 14px;
z-index: -1;
border: 0;
color: white;
left: -65%;
top: -30px;
}
.username {
position: relative;
top: 65px;
}
.password {
position: relative;
top: 130px;
}
.con-pass {
position: relative;
top: 195px;
}
#confirm {
display: inline;
}
input {
position: absolute;
font-family: 'Montserrat', sans-serif;
border: 0;
border-bottom: 2px solid beige;
background: transparent;
font-size: 15px; /*BORDER yes/no*/
height: 25px;
width: 250px;
outline: 0;
z-index: 1;
left: -74px;
top: -30px;
}
span {
position: absolute;
top: 5px;
left: -6px;
transition: top .5s ease, font-size .5s ease;
}
input:focus + label > span,
input:valid + label > span {
top: -20px;
font-size: 11px;
/* padding-bottom: 15px;*/
}
label::after {
content: '';
position: absolute;
top: 27px; /* ::after position */
left: -7px;
width: 250px;
height: 23px;
border-radius: 2px;
transition: transform .3s;
}
label::after {
z-index: -1;
background: beige; /*#a86bf;*/
transform: scale3d(1, 0, 1);
transform-origin: top;
}
input:focus + label::after,
input:valid + label::after {
transform: scale3d(1, -1.3, 1);
transition-timing-function: linear;
top: 27px; /* ::after position */
}
input:focus {
border-radius: 2px;
}
<div class="content">
<p class="head">Register</p>
<form>
<div class="content">
<div class="email">
<input type="text" id="email" required /> <!--input field-->
<label for="email"><span>Email</span></label>
</div>
<div class="username">
<input type="text" id="user" required />
<label for="user"><span>Username</span></label>
</div>
<div class="password">
<input type="text" id="pass" required /> <!--input field-->
<label for="pass"><span>Password</span></label>
</div>
<div class="con-pass">
<input type="text" id="c-pass" required />
<label for="c-pass"><span id="confirm">Confirm Password</span></label>
</div>
</div>
</form>
</div>
You can use white-space: nowrap; for that :
#confirm {
white-space: nowrap;
}
Here is a resource for the white-space property in CSS.
Use white-space: nowrap; for class con-pass
You can also insert a in your html. That will ensure the two Words are kept on the same line:
<label for="c-pass"><span id="confirm">Confirm Password</span></label>

Why is there some excess scale at the bottom? how to remove those?

There's a little royalblue background appearing (between border-bottom: 2px solid white; & ::after element) when I unfocus.
I don't know why is that happening.
body {
background-color: royalblue;/*#f0f0f0;*/
}
label {
font-family: 'Montserrat', sans-serif;
font-size: 14px;
z-index: -1;
border: 0;
color: white;
position: relative;
}
.head {
color: white;
margin-left: 44%;
font-family: monospace;
font-size: 25px;
}
/*.content {
margin-top: 10%;
margin-left: 41%;
}*/
.password {
margin-top: 8%;
}
form {
position: relative;
}
input {
position: absolute;
font-family: 'Montserrat', sans-serif;
font-size: 15px;
background: transparent;
border: 0; /* BORDER yes/no */
border-bottom: 2px solid white;
background: transparent;
outline: 0;
height: 25px;
width: 180px;
z-index: 1;
margin-top: 5px;
}
/*input:focus {
outline: 1;
}*/
label::after {
content: '';
position: absolute;
top: -2px;
left: 0;
width: 180px;
height: 25px;
border-radius: 2px;
transition: transform .3s;
}
label::after{
z-index: -1;
background: beige; /*#a86bf;*/
transform: scale3d(1, 0, 1);
transform-origin: 0% 0%;
}
input:focus {
border-radius: 1px;
}
input:focus + label::after,
input:valid + label::after {
transform: scale3d(1, -1, 1);
transition-timing-function: linear;
}
span {
position: relative;
margin-top: -30px;
display: block;
padding: .6em 0;
padding-left: -5px;
transition: top .5s ease, font-size .5s ease;
/* transition: transform 1s 2s;*/
top: 0;
}
input:focus + label > span,
input:valid + label > span {
top: -20px;
font-size: 11px;
padding-bottom: 15px;
}
/* font-family: monospace;*/
/*transform: translate3d(0, -80%, 0); */
/* transition-timing-function: linear;*/
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<title>Test</title>
</head>
<body>
<p class="head">Sign In</p>
<form>
<div class="content">
<div class="username">
<input type="text" name="name" class="user-input" id="user" required /> <!--input field-->
<label class="user-label" for="user"><span>Username</span></label>
</div>
<div class="password">
<input type="text" name="name" class="pass-input" id="pass" required /> <!-- input field -->
<label class="pass-label" for="pass"><span>Password</span></label>
</div>
</div>
</form>
</body>
</html>
Update:
I changed to top: 1px;, also change border-bottom to black, now this is the result (full code). Why is there some excess scale at the bottom? how to remove those?
You have a top: -2px on label, and your problem is when you blur, so a solution is move top: -2px to input:focus + label::after and input:focus + label::after, so you dont have that gap when its not focused or validated
body {
background-color: royalblue;/*#f0f0f0;*/
}
label {
font-family: 'Montserrat', sans-serif;
font-size: 14px;
z-index: -1;
border: 0;
color: white;
position: relative;
}
.head {
color: white;
margin-left: 44%;
font-family: monospace;
font-size: 25px;
}
/*.content {
margin-top: 10%;
margin-left: 41%;
}*/
.password {
margin-top: 8%;
}
form {
position: relative;
}
input {
position: absolute;
font-family: 'Montserrat', sans-serif;
font-size: 15px;
background: transparent;
border: 0; /* BORDER yes/no */
border-bottom: 2px solid white;
background: transparent;
outline: 0;
height: 25px;
width: 180px;
z-index: 1;
margin-top: 5px;
}
/*input:focus {
outline: 1;
}*/
label::after {
content: '';
position: absolute;
left: 0;
width: 180px;
height: 25px;
border-radius: 2px;
transition: transform .3s;
}
label::after{
z-index: -1;
background: beige; /*#a86bf;*/
transform: scale3d(1, 0, 1);
transform-origin: 0% 0%;
}
input:focus {
border-radius: 1px;
}
input:focus + label,
input:valid + label {
top: -2px;
}
input:focus + label::after,
input:valid + label::after {
transform: scale3d(1, -1, 1);
transition-timing-function: linear;
}
span {
position: relative;
margin-top: -30px;
display: block;
padding: .6em 0;
padding-left: -5px;
transition: top .5s ease, font-size .5s ease;
top: 0;
}
input:focus + label > span,
input:valid + label > span {
top: -20px;
font-size: 11px;
padding-bottom: 15px;
}
/* font-family: monospace;*/
/*transform: translate3d(0, -80%, 0); */
/* transition-timing-function: linear;*/
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<title>Test</title>
</head>
<body>
<p class="head">Sign In</p>
<form>
<div class="content">
<div class="username">
<input type="text" name="name" class="user-input" id="user" required /> <!--input field-->
<label class="user-label" for="user"><span>Username</span></label>
</div>
<div class="password">
<input type="text" name="name" class="pass-input" id="pass" required /> <!-- input field -->
<label class="pass-label" for="pass"><span>Password</span></label>
</div>
</div>
</form>
</body>
</html>
you have an extra code, you can see here in comment section
label::after {
content: '';
position: absolute;
/*top: -2px;*/
left: 0;
width: 180px;
height: 25px;
border-radius: 2px;
transition: transform .3s;
}
Add top:1px on label::after See Below.
label::after {
content: '';
position: absolute;
left: 0;
top: 1px;
width: 180px;
height: 25px;
border-radius: 2px;
transition: transform .3s;
}

How to make two or more slideshows inside tooltips work on the same HTML page?

I have two slideshows made in pure CSS in an html page, each one is inside its own tooltip but one of them (Piediluco) doesn't work properly because its images doesn't slide correctly.
body {
background-color: #000000;
}
.tooltip, .tooltip2 {
position: relative;
display: inline-block;
padding: 400px 0 0 0;
margin: 0;
cursor: pointer;
color: #5790ce;
}
.tooltip:hover .info, .tooltip:focus .info,
.tooltip2:hover .info2, .tooltip2:focus .info2 {
visibility: visible;
opacity: 1;
transform: translate3d(0, 0, 0);
}
.info, .info2 {
box-sizing: border-box;
position: absolute;
bottom: -380px;
left: 95px;
display: block;
background: #FFFFFF;
border: 1px solid #000000;
width: 500px;
font-size: 25px;
line-height: 24px;
text-align: justify;
cursor: text;
visibility: hidden;
opacity: 0;
transform: translate3d(0, -20px, 0);
transition: all .5s ease-out;
}
.info:before, .info2:before {
position: absolute;
content: '';
width: 100%;
height: 14px;
bottom: -14px;
left: 0;
}
.info:after, .info2:after {
position: absolute;
content: '';
width: 10px;
height: 10px;
transform: rotate(45deg);
bottom: 378px;
right: 494px;
margin-left: -5px;
background: #8d7200;
}
#i1, #i2, #i3, #i4,
#i12, #i22, #i32, #i42 {
display: none;
}
.container, .container2 {
margin: 0;
position: relative;
width: 100%;
height: 120px;
padding-bottom: 38%;
user-select: none;
background-color: #1c1c1c;
}
.container .slide_img,
.container2 .slide_img2 {
position: absolute;
width: 100%;
height: 100%;
}
.container .slide_img .img,
.container2 .slide_img2 .img2 {
width: inherit;
height: inherit;
}
.container .slide_img .caption,
.container2 .slide_img2 .caption2 {
position: relative;
display: inline-block;
width: 100%;
bottom: 46px;
text-align: center;
padding-top: 5px;
padding-bottom: 14px;
background-color: rgba(242,242,242,.5);
color: #FFFFFF;
}
.lblp, .lbln, .lblp2, .lbln2 {
width: 12%;
height: 22%;
position: absolute;
top: 40%;
background-color: rgba(242,242,242,.3);
z-index: 99;
transition: background-color 1s;
cursor: pointer;
}
.lbln, .lbln2 {
right: 0;
border-radius: 5px 0 0 5px;
}
.lblp, .lblp2 {
left: 0;
border-radius: 0 5px 5px 0;
}
.lblp:hover, .lbln:hover,
.lblp2:hover, .lbln2:hover {
background-color: rgba(242,242,242,.1);
}
.prev, .prev2 {
position: absolute;
font-family: Arial, sans-serif;
color: rgba(244, 244, 244,.9);
font-size: 40pt;
padding: 0 0 15px 20px;
margin: 0;
top: 25%;
transition: color 1s;
}
.next, .next2 {
position: absolute;
font-family: Arial, sans-serif;
color: rgba(244, 244, 244,.9);
font-size: 40pt;
padding: 0 0 15px 25px;
margin: 0;
top: 25%;
transition: color 1s;
}
.prev:hover, .next:hover,
.prev2:hover, .next2:hover {
color: rgba(244, 244, 244,1);
}
.slide_img, .slide_img2 {
z-index: -1;
}
#i1:checked ~ #one,
#i2:checked ~ #two,
#i3:checked ~ #three,
#i4:checked ~ #four,
#i12:checked ~ #one2,
#i22:checked ~ #two2,
#i32:checked ~ #three3,
#i42:checked ~ #four2 {
z-index: 9;
animation: scroll 1s ease-in-out;
}
#keyframes scroll{
0%{ opacity:.4;}
100%{opacity:1;}
}
.text, .text2 {
display: block;
padding: 14px 17px 35px 17px;
color: #8d7200;
}
.more, .more2 {
display: inline;
position: relative;
bottom: 20px;
left: 215px;
margin: 0;
padding: 3px 10px;
font-family: 'Times New Roman', sans-serif;
text-decoration: none;
color: green;
font-size: 20px;
font-weight: bold;
border: 2px solid green;
border-radius: 5px;
transition: background-color 0.5s, color 0.5s;
}
.more:hover, .more:focus,
.more2:hover, .more2:focus {
background-color: green;
color: #FFFFFF;
}
<div onclick="void(0);" class="tooltip">Trasimeno
<div class="info">
<div class="container">
<input type="radio" id="i1" name="images" checked>
<input type="radio" id="i2" name="images">
<input type="radio" id="i3" name="images">
<input type="radio" id="i4" name="images">
<div class="slide_img" id="one">
<img class="img" src="https://i.imgur.com/W5E69l9.jpg">
<span class="caption">...................</span>
<label class="lblp" for="i4"><span class="prev">‹</span></label>
<label class="lbln" for="i2"><span class="next">›</span></label>
</div>
<div class="slide_img" id="two">
<img class="img" src="https://i.imgur.com/eGbNeOB.jpg">
<span class="caption">...................</span>
<label class="lblp" for="i1"><span class="prev">‹</span></label>
<label class="lbln" for="i3"><span class="next">›</span></label>
</div>
<div class="slide_img" id="three">
<img class="img" src="https://i.imgur.com/hp2OiNB.jpg">
<span class="caption">...................</span>
<label class="lblp" for="i2"><span class="prev">‹</span></label>
<label class="lbln" for="i4"><span class="next">›</span></label>
</div>
<div class="slide_img" id="four">
<img class="img" src="https://i.imgur.com/MHZj0eb.jpg">
<span class="caption">...................</span>
<label class="lblp" for="i3"><span class="prev">‹</span></label>
<label class="lbln" for="i1"><span class="next">›</span></label>
</div>
</div>
<div class="text">...................................................</div>
<a class="more" href="#" target="_blank">More</a>
</div>
</div>
<div onclick="void(0);" class="tooltip2">Piediluco
<div class="info2">
<div class="container2">
<input type="radio" id="i12" name="images2" checked>
<input type="radio" id="i22" name="images2">
<input type="radio" id="i32" name="images2">
<input type="radio" id="i42" name="images2">
<div class="slide_img2" id="one2">
<img class="img2" src="https://i.imgur.com/S12ZVXY.jpg">
<span class="caption2">.....................</span>
<label class="lblp2" for="i32"><span class="prev2">‹</span></label>
<label class="lbln2" for="i12"><span class="next2">›</span></label>
</div>
<div class="slide_img2" id="two2">
<img class="img2" src="https://i.imgur.com/3JcEZp7.jpg">
<span class="caption2">.....................</span>
<label class="lblp2" for="i32"><span class="prev2">‹</span></label>
<label class="lbln2" for="i12"><span class="next2">›</span></label>
</div>
<div class="slide_img2" id="three2">
<img class="img2" src="https://i.imgur.com/kayLkDW.jpg">
<span class="caption2">.....................</span>
<label class="lblp2" for="i32"><span class="prev2">‹</span></label>
<label class="lbln2" for="i12"><span class="next2">›</span></label>
</div>
<div class="slide_img2" id="four2">
<img class="img2" src="https://i.imgur.com/gfRwbU2.jpg">
<span class="caption2">.....................</span>
<label class="lblp2" for="i32"><span class="prev2">‹</span></label>
<label class="lbln2" for="i12"><span class="next2">›</span></label>
</div>
</div>
<div class="text2">...................................................</div>
<a class="more2" href="#" target="_blank">More</a>
</div>
</div>
How can I find the error/s?