3
Guys, I’m creating a login screen where I want to use placeholder
and onfocus
for when the user clicks on the box disappear what is written (for example: "e-mail") and, if it erases everything again, the word "e-mail" appears again.
I managed to do it with the following code
<div class="dados-div" id="dados-senha">
<input type="password" placeholder="senha" onfocus="this.placeholder = ''" onblur="this.placeholder = 'senha'" />
</div>
However, I need to leave the word without this blur
and I can’t.
EDIT
Putting the whole code
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8"/>
<title>Login trevoso</title>
<style>
@import url(http://fonts.googleapis.com/css?family=Open+Sans);
body {
background-color: #00aba9
}
#login-box{
background-color: #ffffff;
width: 800px;
height: 325px;
position:absolute; /* Aqui começa a rotina que vai até o final do estilo e centraliza a box no meio da tela, conforme Léo of the North pediu. Redimensiona se o user redimensionar o navegador */
left:50%;
top:50%;
margin-left:-400px;
margin-top:-162.5px;
}
#login-box-shadow{
background-color: #ffffff;
width: 800px;
height: 326px;
margin: auto auto 0px;
box-shadow: 0px 0px 8px grey;
}
#login-trevoso {
background-color: white;
font: bold 33pt/33px sans-serif;
color: #00aba9;
padding: 32px 29px 15px;
font-family: 'Open Sans', sans-serif;
}
.dados-div input{
width: 750px;
height: 60px;
padding-left: 20px;
font: italic 18pt/10px sans-serif;
font-family: 'Open Sans', sans-serif;
color: #2e2e2e;
border-radius: 3px;
border: 1px solid #b0b0b0;
outline: none;
}
.dados-div {
margin-left:15px;
margin-top:15px;
}
.dados-div:hover input{
border-color: #00aba9;
}
#botao {
float:right;
margin-right: 24px;
color: white;
background-color: #00aba9;
padding: 15px 33px;
border-radius:3px;
border-bottom: 3px solid #007372;
font: bold 12,41pt sans-serif;
font-family: 'Open Sans', sans-serif;
margin-top:19px;
cursor:pointer;
transition: background-color 1s;
}
#botao:hover {
background-color: #007372;
}
#miss {
margin-top:15px;
margin-left: 30px;
font: normal 13pt sans-serif;
font-family: 'Open Sans', sans-serif;
cursor:pointer;
}
</style>
</head>
<body>
<div id="login-box">
<div id="login-box-shadow">
<div id="login-trevoso"> Login </div>
<div class="dados-div" id="dados-usuario">
<div class="dados-div" id="dados-senha">
<input type="text" placeholder="e-mail" onfocus="this.placeholder = ''" onblur="this.placeholder = 'e-mail'" />
</div>
</div>
<div class="dados-div" id="dados-senha">
<div class="dados-div" id="dados-senha">
<input type="password" placeholder="senha" onfocus="this.placeholder = ''" onblur="this.placeholder = 'senha'" />
</div>
</div>
<div id="botoes">
<div id="botao">ENVIAR</div>
<!-- <div id="Lembrar-me"><input type="checkbox"/>Lembrar-me neste computador?</div>-->
</div>
<div id="miss"><a href="trouxao.html" style="text-decoration:none">Esqueceu a senha?</a></div>
</div>
</div>
</div>
</body>
</html>
You are already using the placeholder="Text in the field"
– Sr. André Baill
@maxixilianoMeyer try to be clearer
– Sr. André Baill
From what I understand, he wants that when the user deletes the password, that reappears the placeholder... includes the snippet to facilitate understanding, but have not yet approved the edition... I do not know if you can do only with HTML... @Andrébaill
– gustavox
But @gustavox the placeholder itself does this
– Sr. André Baill
That’s it, @Gustavox. That reappears the placeholder, but without the Blur
– Evilmaax
@Andrébaill looks at the snippet (Execute code snippet)... When you delete the password it does not return the placeholder text...
– gustavox
I posted an answer with the simulation, in my view, that would be
– Sr. André Baill
@Maximilianomeyer when you say, "without that
blur
" do you mean the color of the font? Take off the gray color and put black in the placeholder?– user3603
Isso@gerep In addition Blur is changing the formatting I did, leaving the larger font, for example, cutting the top part of the word that is too big for the box
– Evilmaax
@Maximilianomeyer, you can update the example showing this problem with the font?
– user3603
I set you an example, maybe that’s your idea?
– Sr. André Baill
@Gerep I put the whole code
– Evilmaax
@Andrébaill I will test
– Evilmaax
@Maximilianomeyer your problem with the source is on this line
font: italic 18px/10px sans-serif;
'cause you’re doing it that way?– user3603
@Gerep is part of the "instructions" of the task. The font must be italicized and have this size. Thanks for the touch, I noticed that there was something extra right there, I took the 10px and was cool, no more cuts the text
– Evilmaax
@Maximilianomeyer, in my reply I explained a little better what happens in this line.
– user3603
@Maximilianomeyer, to help the community, choose the answer that helped you.
– user3603
@Gerep had not scheduled any, because for me they did not work well. Well, I’ll mark the best answer, because you can still help others.
– Evilmaax