<div>
	<input type="checkbox" />
	<span></span>
	<input type="text" placeholder="hogehoge" />
</div>
<div class="piyo"><p>↑ ロックを外すと入力できます</p></div>
html {
	box-sizing: border-box;
}

*,
*:before,
*:after {
	box-sizing: inherit;
}

html,
body {
	height: 100vh;
}

body {
	background: #cad1e7;
	color: #4a5568;
	font-size: 16px;
	font-family: "Fira Sans", sans-serif;
}
p {
	margin: auto;
	width: 370px;
	margin-top: 15px;
}
div {
	--field-size: 50px;
	--field-border-color: #ccc;
	margin: auto;
 top:40px;
	font-size: 1rem;
	background: #ffffff;
	border-radius: 5px;
	position: relative;
	width: 400px;
	overflow: hidden;
	display: flex;
	background: white;
}
.piyo{background:none;}
div input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	width: var(--field-size);
	height: var(--field-size);
	cursor: pointer;
	padding: 0;
	margin: 0;
}
div input[type="checkbox"]:hover + span {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%233fc079' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'%3E%3C/rect%3E%3Cpath d='M7 11V7a5 5 0 0 1 9.9-1'%3E%3C/path%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center center;
	background-size: 50%;
}
div input[type="checkbox"]:checked + span {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%233fc079' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'%3E%3C/rect%3E%3Cpath d='M7 11V7a5 5 0 0 1 9.9-1'%3E%3C/path%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center center;
	background-size: 50%;
}
div input[type="checkbox"]:checked + span::before,
div input[type="checkbox"]:checked + span::after {
	pointer-events: none;
}
div input[type="checkbox"]:checked + span::after {
	transform: translateY(-100%);
}
div input[type="checkbox"]:checked + span::before {
	transform: translateY(100%);
}
div input[type="checkbox"] + span {
	width: var(--field-size);
	height: var(--field-size);
	border-right: 1px solid var(--field-border-color);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23909090' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-lock'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'%3E%3C/rect%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'%3E%3C/path%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center center;
	background-size: 50%;
	cursor: pointer;
}
div input[type="checkbox"] + span::after,
div input[type="checkbox"] + span::before {
	content: "";
	position: absolute;
	right: 0;
	height: 50%;
	left: var(--field-size);
	transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
	background: rgba(0, 0, 0, 0.075);
	z-index: 2;
	cursor: not-allowed;
}
div input[type="checkbox"] + span::after {
	top: 0;
}
div input[type="checkbox"] + span::before {
	bottom: 0;
}
div input[type="text"] {
	padding: 1em;
	border: 0;
	flex: 1;
	font-size: 1rem;
	--placeholder-color: #ababab;
	font-family: inherit;
}
div input[type="text"]::-webkit-input-placeholder {
	color: var(--placeholder-color);
}
div input[type="text"]:-ms-input-placeholder {
	color: var(--placeholder-color);
}
div input[type="text"]::-moz-placeholder {
	color: var(--placeholder-color);
}
div input[type="text"]:-moz-placeholder {
	color: var(--placeholder-color);
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.