HomeCollege ProjectLight ON/OFF Lamp Project - Technic Dude

Light ON/OFF Lamp Project – Technic Dude

HTML CODE

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Lamp Checkbox</title>
    <link
      href="https://fonts.googleapis.com/css2?family=Poppins:wght@600&display=swap"
      rel="stylesheet"
    />
  </head>
  <body>
    <div class="wrapper">
      <div class="container">
        <div class="lamp">
          <input type="checkbox" />
        </div>
      </div>
      <a href="https://www.youtube.com/watch?v=oSYUVc6DiM0" target="_blank"
        >My YouTube Channel</a
      >
    </div>
  </body>
</html>

CSS CODE

body {
    padding: 0;
    margin: 0;
    background-color: #000000;
}

.wrapper {
    height: 420px;
    width: 350px;
    position: absolute;
    -webkit-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    left: 50%;
    top: 50%;
}

.container {
    height: 350px;
    width: 350px;
    position: absolute;
    top: 0;
}


/* Lamp Top */

.lamp {
    height: 0;
    width: 170px;
    border-bottom: 150px solid #2987e4;
    border-right: 30px solid transparent;
    border-left: 30px solid transparent;
    position: absolute;
    margin: auto;
    left: 0;
    right: 0;
    top: 40px;
}


/* Lamp Stand */

.lamp:before {
    content: "";
    position: absolute;
    height: 100px;
    width: 10px;
    background-color: #ffffff;
    margin: auto;
    left: 0;
    right: 0;
    top: 150px;
}


/* Lamp Base */

.lamp:after {
    content: "";
    position: absolute;
    height: 50px;
    width: 100px;
    background-color: #2987e4;
    top: 230px;
    margin: auto;
    left: 0;
    right: 0;
    border-radius: 50px 50px 0 0;
}


/* Lamp Switch String */

input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #ffffff;
    height: 25px;
    width: 5px;
    position: absolute;
    top: 147px;
    left: 170px;
    outline: none;
    -webkit-transition: 0.5s;
    -o-transition: 0.5s;
    transition: 0.5s;
}


/* Lamp Switch String 2 */

input[type="checkbox"]:after {
    content: "";
    position: absolute;
    height: 15px;
    width: 15px;
    background-color: #ffffff;
    border-radius: 50%;
    left: -5px;
    bottom: -2px;
}


/* Light */

input[type="checkbox"]:before {
    content: "";
    position: absolute;
    height: 130px;
    width: 200px;
    left: -188px;
    z-index: -5;
    -webkit-clip-path: polygon(10% 0, 90% 0, 100% 100%, 0 100%);
    clip-path: polygon(10% 0, 90% 0, 100% 100%, 0 100%);
    -webkit-transition: 0.5s;
    -o-transition: 0.5s;
    transition: 0.5s;
    pointer-events: none;
}

input[type="checkbox"]:checked {
    height: 40px;
}

input[type="checkbox"]:checked:before {
    background: -webkit-gradient( linear, left top, left bottom, from(rgba(41, 135, 228, 0.5)), to(rgba(41, 135, 228, 0.1)));
    background: -o-linear-gradient( rgba(41, 135, 228, 0.5), rgba(41, 135, 228, 0.1));
    background: linear-gradient( rgba(41, 135, 228, 0.5), rgba(41, 135, 228, 0.1));
}

a {
    display: block;
    width: 100%;
    background-color: #ffffff;
    color: #2987e4;
    font-size: 20px;
    text-align: center;
    padding: 15px 0;
    font-family: "Poppins", sans-serif;
    position: absolute;
    bottom: 0;
    text-decoration: none;
    border-radius: 5px;
}

JS CODE

alert("Click on the WHITE STRING to turn it ON and OFF")

RUN THIS CODE

<>img src="light.jpg" alt="light app"

READ MORE

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

- Advertisment -