Below is the HTML
code for my form:
<div style="display:block; margin:0 auto;">
<h2>Welcome</h2>
</div>
<div id="box">
<div id="box2">
<p id="pid"><b>Emp no:</b></p>
<input type="text" id="id" size="30" maxlength="11" onkeypress="return event.charCode != 32">
<p id="ppass"><b>Password:</b></p>
<input type="password" id="pass" size="30" maxlength="30"> <i class="far fa-eye-slash"></i><br><br><br><br>
</div>
</div>
<div id="box1">
<button id="login">Sign in</button>
</div>
The following is the CSS
code:
#box{
text-align: center;
box-shadow: 0 5px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.5s;
height:auto;
z-index: -1;
margin:0 auto;
width: 25em;
border-radius: 8px;
background-color: #cbeef1;
padding:10px 10px 10px 10px;
}
#box2{
display: inline-block;
margin: 0 auto;
}
#box:hover {
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}
#box1{
display: table;
margin-left: auto;
margin-right: auto;
}
#login{
border-radius: 6px;
cursor: pointer;
font-size: medium;
padding: 5px;
}
h2{
background-color: aliceblue;
font-size: medium;
padding: 10px 10px 10px 10px;
width: 5em;
border-style: solid;
margin: 0 auto;
display:block;
}
This is what is being displayed:
In the image provided, I need the button
and the h2
elements to overlap with the box
div. Additionally, I want the input fields to line up neatly, similar to the image shown below:
I would appreciate any guidance on achieving this effect.
For a live demonstration, visit my fiddle: here