-1
Hello, I created a text input, and would like to hide it after the user selects it for the fill. I lined up a label inside the input simulating a placeholder.(I chose this option to make it easier to style) but when I put the display:none;
after Focus nothing happens, which is the most efficient way to hide my label ?
#config {
font-family: 'Poetsen One', sans-serif;
font-size: 12px;
color:#646464;
text-align: center;
}
input {
border: 2px solid #646464;
border-radius: 30px;
background-color: transparent;
padding: 6px;
margin: 0 6px;
font-family: 'Poetsen One', sans-serif;
font-size: 15px;
color: #919191;
border-radius: 30px;
outline: none;
}
input:focus {
box-shadow: 0px -1px 10px rgba(57, 182, 78, 0.5),
0px 0px 15px rgba(57, 182, 78, 0.5);
}
input:focus > label {
display: none;
}
label {
position: absolute;
margin: 5px 32px;
font-size: 16px;
cursor: text;
z-index: -1;
}
label::before {
font-family: "Font Awesome 5 Free"; font-weight: 900; content: "\f4ff";
}
#lbl-score::before {
font-family: "Font Awesome 5 Free"; font-weight: 900; content: "\f091";
}
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<link rel='stylesheet' type="text/css" href='CSS/teste.css' >
<link rel="icon" href="CSS/img/favicon.ico" type="image/x-icon">
<link rel='stylesheet' type="text/css" href='CSS/fontawesome-free-5.11.2-web/css/all.css'>
<title>Dice - The Game</title>
</head>
<body>
<section id='config'>
<h1 id='text'><i class="fa fa-exclamation-circle"></i>Change or modify the name of the players</h1>
<label id='lbl-player-0'> Name Player 1</label><input id='ipt-player-0' class="ipt-name-change"></input>
<label id='lbl-player-1'> Name Player 2</label><input id='ipt-player-1' class="ipt-name-change"></input>
<h1 id='text'><i class="fa fa-exclamation-circle"></i> Reset the Winner conditions</h1>
<label id="lbl-score"> Score for Winner</label><input id='ipt-score' type='number'class="ipt-name-change"></input>
</body>
</html>
Muiito Well, I thought I would really have to appeal to the js,
– user77295