Mount CSS from Image

Asked

Viewed 98 times

5

I have the image below that shows a form HTML. inserir a descrição da imagem aqui

I wanted to make that effect in the form but I couldn’t.

Can someone help me?

Follow my lead.

body {
  font-family: 'Roboto', sans-serif;
  background-color: rgb(40, 22, 111);
}

.logon {
  position: relative;
  top: 50% - 150px;
  width: 300px;
  height: 220px;
  margin: 0 auto;
  border: 4px rgb(93, 138, 168) solid;
  border-radius: 20px;
  background-color: rgb(255, 255, 255);
}

.logon * {
  display: block;
  margin: 5px auto;
}

.logon input,
.logon button {
  font-size: .7em;
  padding: 3px;
  border-top: 2px rgb(10, 10, 10) solid;
  border-right: 1px rgb(10, 10, 10) solid;
  border-left: 1px rgb(10, 10, 10) solid;
  border-bottom: 3px rgb(255, 255, 255) solid;
}

.logon h2 {
  width: 250px;
  height: 30px;
  text-align: center;
  color: rgb(0, 0, 0);
}

.logon input {
  width: 250px;
  height: 30px;
  background: rgba(10, 10, 10, .3);
  color: rgb(0, 0, 0);
}

.logon .lembra {
  width: 250px;
  height: 30px;
  color: rgb(0, 0, 0);
}

.logon button {
  width: 260px;
  height: 40px;
  background-color: rgb(0, 0, 0);
  color: rgb(255, 255, 255);
}
<div class="logon">
  <h2>Acessar Sistema</h2>
  <input type="text" name="usuario" id="usuario" placeholder="usuário" />
  <input type="password" name="senha" id="senha" placeholder="senha" />
  <div class="lembra"></div>
  <button id="logar">LOGIN</button>
</div>

  • 1

    Carlos what part of the effect? That white glow on the edges, or that diagonal line in the middle of the form? Or both? What is the approximate acceptable fidelity level for the code to match image 90%?

  • So, good morning and happy new year. It would be this black shading on the bottom of the body and the white glitter on the edges. That form body rise looks like it’s just a background but I’m having a lot of trouble. The bar doesn’t need

  • This background color of the form looks like it is not solid. It gives the impression that it has taken the blue and filled several internal pixels with black. How to get this done in CSS?

1 answer

7


Here is an option.

inserir a descrição da imagem aqui

Study the background styles well body, that is nothing more than a radial-gradient, which goes from the brightest middle to the darkest end, giving this effect that you commented on. Read the documentation of the radial-gradient here https://developer.mozilla.org/en-US/docs/Web/CSS/radial-gradient

Attention also with class styles .logon which is where there is more. Beyond the pseudo-elements ::after and ::before which was what I used to make the sparkles on the edge. On the edge of the . logon, I used a gradient, for that I needed to use border-image and border-image-slice

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}
body {
  font-family: 'Roboto', sans-serif;
  background-image: radial-gradient(#ACCCC1 20%, #39594E);
  background-size: cover;
  background-repeat: no-repeat;
  display: flex;
  justify-content: center;
  align-items: center;
}
.logon {
  position: relative;
  width: 300px;
  height: 220px;
  margin: 0 auto;	
  box-shadow: inset 0 18px 32px 0px rgba(0,0,0, 0.1) ;
  border: 2px solid;
  border-image: linear-gradient(rgba(255,255,255, 0.5) 40%, rgba(255,255,255, 0.05) 60%);
  border-image-slice: 1;
  border-radius: 20px;
  background-image: linear-gradient(-10deg, rgba(255,255,255, 0.05) 49%, 
  rgba(255,255,255, 0.25) 50%), radial-gradient( rgba(57, 89, 78, 0.5), #ACCCC1);
}
.logon::after,
.logon::before {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: rgba(255,255,255, 0.5);
  filter: blur(2px);
  transform: scaleX(10);
  border-radius: 50%;
  top: -5px;
  left: 30%;

}
.logon::before {
  top: unset;
  left: unset;
  right: 30%;
  bottom: -5px;
}
.logon * {			
  display:block;
  margin: 5px auto;	
}		
.logon input,
.logon button{
  font-size: .7em;		
  padding: 3px;
  border-top: 2px rgba(10,10,10, 0.35) solid;
  border-right: 1px rgba(10,10,10, 0.05) solid;
  border-left: 1px rgba(10,10,10, 0.05) solid;
  border-bottom: 3px rgba(255,255,255, 0.35) solid;
  border-radius: 3px;
}
.logon h2{
  width: 250px;
  height: 30px;
  text-align: center;
  color: rgb(0,0,0);
}		
.logon input {
  width: 250px;
  height: 30px;
  background: transparent;
  color: rgb(0,0,0);
}
.logon .lembra {
  width: 250px;
  height: 30px;
  color: rgb(0,0,0);
}
.logon button{
  width: 260px;
  height: 40px;
  /* background-color: rgb(0,0,0); */
  border: none;
  color: #fff;
  background-color: #3A4644;
} 
<div class="logon">
  <h2>Acessar Sistema</h2>
  <input type="text" name="usuario" id="usuario" placeholder="usuário" />
  <input type="password" name="senha" id="senha" placeholder="senha" />
  <div class="lembra"></div>
  <button id="logar">LOGIN</button>
</div>

  • Thank you very much, I will take your advice. I am better at backend. If I can be useful I am here. Now I will search to place an icon inside the input

  • @Carlosrocha normal, I do not know anything back rss, about the icon in the input already tell you that input does not accept pseudo element, so you may need to put it inside a label. But when you doubt opens a question I give you strength

  • yeah, I figured. I think I’ll do a diva with an icon and a text float left. I’ll see here

Browser other questions tagged

You are not signed in. Login or sign up in order to post.