Home > database >  how to stop changing effect of input fields and form while hovering?
how to stop changing effect of input fields and form while hovering?

Time:01-12

I have create a form with 1 px input fields border, I need 2 px border while hovering so give exact by css. Now the problem is it also changing the effects of input fields and form when I hovering. How to stop this effect? Sorry for my bad English. Thank you.

Thank you in advance guys.

Html code: `

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Register</title>
<link rel="stylesheet" href="style.css">

</head>
<body>
    <div > 
        <div >
            <div >
                
            </div>
            <form action="#">
                <div >
                    <label>Name</label>
                </div>
                <div >
                    <div >
                        <input type="text"  id="name" placeholder="Name" required ><span >*</span>
                    </div>
                    <div >
                        <input type="text"  id="surname" placeholder="Surname" required><span >*</span>
                    </div> 
                </div>
                <div >
                    <label>Address</label>
                </div>
                <div >
                    <input type="text" id="name" placeholder="Address Line 1" required><span >*</span>
                </div>
                <div >
                    <input type="text" id="name" placeholder="Address Line 2">
                </div>
                <div >
                    <div >
                        <input type="text" id="name" placeholder="City" required><span >*</span>
                    </div>
                    <div >
                        <input type="text" id="name" placeholder="Region / State" required><span >*</span>
                    </div>
                    <div >
                        <input type="text" id="name" placeholder="Post Code / Zip">
                    </div>  
                </div>
                <div >
                    <label>Contact</label>
                </div>
                <div >
                    <div >
                        <input name="email" type="email" id="email" placeholder="Email" required><span >*</span>
                    </div>
                    <div >
                        <input type="tel" id="tel" placeholder="Phone No (incl. country code)" required><span >*</span>
                    </div>
                </div>
                <div >
                    <input type="checkbox" name="signup" id="signup" alt="Sign" placeholder="signup"> <label> Sign</label>
                </div>
                <div >
                    <div >
                        <label>Product</label>
                    </div>
                    <div >
                        <label>Date of Purchase</label>
                    </div>
                    
                </div>
                <div >
                    <div ><p id="Hello" style="color: red; margin-right: 120px; position: absolute; margin-left: 162px;font-size: large;"></p>
                        <select aria-lebel="products" name="Select-Product" id="products"  form="register-form" required>
                            <option value="" disabled selected hidden>Select Your Product</option>
                            <option value="Product 1">Product 1</option>
                            <option value="Product 2">Product 2</option>
                            <option value="Product 3">Product 3</option>
                            <option value="Product 4">Product 4</option>
                        </select>
                    </div>
                    <div >
                        <label for="purchase-date"></label>
                        <input type="date" id="purchase-date" placeholder="" name="purchase-date" value="2018-07-22" required>
                    </div>
                </div>
                <div >
                    <label>Place of Purchase</label>
                </div>
                <div >
                    <div >
                        <select id="Place-of-Purchase" name="Place of Purchase" form="register-form">
                            <option value="Place of Purchase" disabled selected hidden>hey</option>
                            <option value="Option 1">Option 1</option>
                            <option value=""></option>
                            <option value="Option 3">Option 3</option>
                            <option value="Option 4">Option 4</option>
                        </select>
                    </div>
                </div>
                <div >
                    <input type="submit" style="align-items: center;" value="Submit">
                </div>
            </form>
            <div >
                <p>For more about how we use your information, please see our Privacy Policy.</p>
            </div> 
        </div>
    </div>
    <!-- asterisk for select-products -->
    <script>
        document.getElementById("Hello").innerHTML = "*";
        let element = document.getElementById(title);
        alert(element.href);
    </script>      
</body>
</html>
`

CSS: `

body{
    color: rgb(131 131 131 / 76%);
    font-family: HelveticaNeue, sans-serif;
    position: relative;

    
}
html {
    height: 100%;
}
.form-container{
    align-items: center;
    margin: 10px auto 0px;
    display: flex;  
    box-sizing: border-box; 
    width: 800px;
}
.form{
    margin: auto; 
    padding: 20px;
}
body .form-container .form .para{
    margin-top: 10px;
    margin-bottom: 35px;
    padding: 0px;
}
.row {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    margin-bottom: 5px;
}
.column-left {
    width: 50%;
    display: flex;
    float: left;
}


.column-right {
    width: 50%;
    display: flex;
    float: right;
}

.column-add {
    width: 33%;
    display: flex;
    float: left;
    padding:auto;
}
.column-right-add {
    width: 33%;
    display: flex;
    float: right;
}
.column-middle-add {
    width: 33%;
    display: flex;
    justify-content: center;
    
}

input[type=text], textarea, select {
    padding: 0.8rem; 
    border: 1px solid rgb(133, 133, 133);  
    margin-top: 6px; 
    margin-bottom: 16px; 
    margin-right: 15px;
    width:100%;
    font-size: medium;
    font-weight: 300;
    
}
input[type=text]:hover{
    border: 2px solid rgb(64, 63, 63);  
}
input[type=email]:hover{
    border: 2px solid rgb(64, 63, 63);  
}
input[type=tel]:hover{
    border: 2px solid rgb(64, 63, 63);  
}
input[type=email], textarea, select {
    padding: 0.8rem; 
    border: 1px solid rgb(133, 133, 133);
    box-sizing: border-box; 
    margin-top: 6px; 
    margin-bottom: 16px; 
    margin-right: 15px;
    width:100%;
    font-size: medium;
    font-weight: 300;
}
input[type=tel], textarea, select {
    padding: 0.8rem; 
    border: 1px solid rgb(133, 133, 133); 
    box-sizing: border-box; 
    margin-top: 6px; 
    margin-bottom: 16px; 
    margin-right: 15px;
    width:100%;
    font-size: medium;
}



input[type="date" i], textarea {
    padding: 0.8rem; 
    border: 1px solid rgb(133, 133, 133);
    box-sizing: border-box; 
    margin-top: 6px; 
    margin-bottom: 16px; 
    margin-right: 15px;
    width:100%;
    color: #6c6565;
    font-size: medium;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 300;
}

select#Date-of-Purchase {
    color: rgba(84, 82, 82, 0.798);
}
select#Place-of-Purchase {
    color: rgba(84, 82, 82, 0.798);
}

.signup{
    margin-top: 10px;
    margin-bottom:10px;
    vertical-align: middle;
    display: inline-block;
}
.signup label{
    font-weight: 300;
}
input#signup {
    vertical-align: middle;
    width: 25px;
    height: 25px;
}
input[type=text]:focus {
    border-color:rgb(69, 69, 69);
}
input[type=submit] {
    padding:10px 65px; 
    background:rgba(107, 103, 101, 0.831); 
    border:0 none;
    cursor:pointer;
    border-radius: 30px; 
    color: white;
    margin-top: 35px;
}
p {
    font-family: system-ui;
    color: #6c6565;
}
.btn{
    align-items: center;
    display:flex;
    justify-content: center;
}
label {
    font-weight:600;
    color: rgba(84, 82, 82, 0.798);
    vertical-align: middle;
}
select {
    appearance: none;
    background: white;
    background-image: url("data:image/svg xml,");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    border-radius: 2px;
    color: #6c6565;
    
}
.policy-text{
    margin-top: 60px;
    margin-bottom: 120px;;
}
.danger{
    color: red;
    position: absolute;
    margin-left: 62px;
    margin-top: 15px;
    font-size: large;
    opacity: 1;
    pointer-events: none; 
    
}
input:focus   .danger { 
    display: none; 
} 
input:focus   .danger-surname { 
    display: none; 
} 
input:focus   .danger-address { 
    display: none; 
} 
input:focus   .danger-city { 
    display: none; 
} 
input:focus   .danger-email { 
    display: none; 
} 
input:focus   .danger-phone { 
    display: none; 
} 
input:focus   .danger-region { 
    display: none; 
} 
.danger .danger-surname .danger-address .danger-city .danger-email .danger-phone .danger-region :after{
    display: none!important;
    opacity: 0;
}
input::selection   #Hello{
    display: none;
}
input:focus::-webkit-input-placeholder  {color:transparent;}
input:focus::-moz-placeholder   {color:transparent;}
input:-moz-placeholder   {color:transparent;}
.danger-surname{
    color: red;
    position: absolute;
    margin-left: 82px;
    margin-top: 15px;
    font-size: large;
}
.danger-address{
    color: red;
    position: absolute;
    margin-left: 128px;
    margin-top: 15px;
    font-size: large;
}
.danger-city{
    color: red;
    position: absolute;
    margin-left: 48px;
    margin-top: 15px;
    font-size: large;
}
.danger-region{
    color: red;
    position: absolute;
    margin-left: 18px;
    margin-top: 15px;
    font-size: large;
}
.danger-email{
    color: red;
    position: absolute;
    margin-left: 60px;
    margin-top: 15px;
    font-size: large;
}
.danger-phone{
    color: red;
    position: absolute;
    margin-left: 230px;
    margin-top: 15px;
    font-size: large;
}
::-webkit-input-placeholder { opacity: 1; -webkit-transition: opacity .5s; transition: opacity .5s; }  /* Chrome <=56, Safari < 10 */
:-moz-placeholder { opacity: 1; -moz-transition: opacity .5s; transition: opacity .5s; } /* FF 4-18 */
::-moz-placeholder { opacity: 1; -moz-transition: opacity .5s; transition: opacity .5s; } /* FF 19-51 */
:-ms-input-placeholder { opacity: 1; -ms-transition: opacity .5s; transition: opacity .5s; } /* IE 10  */
::placeholder { opacity: 1; transition: opacity .5s; } /* Modern Browsers */
*:focus::-webkit-input-placeholder { opacity: 0; } /* Chrome <=56, Safari < 10 */
*:focus:-moz-placeholder { opacity: 0; } /* FF 4-18 */
*:focus::-moz-placeholder { opacity: 0; } /* FF 19-50 */
*:focus:-ms-input-placeholder { opacity: 0; } /* IE 10  */
*:focus::placeholder { opacity: 0; } /* Modern Browsers */

/* media queries */
@media only screen and (max-width: 600px) {
.column-left, .column-right,.column-add,.column-middle-add, .column-right-add,.row {
    width: 100%;
    flex-direction: column;
    display: flex;                   
}
.danger-region{
    margin-left: 125px;
    margin-top: -25px;
}
}
`

CodePudding user response:

Please use box-shadow: 0 0 0 2px rgb(64, 63, 63); property instead of border.

body{
    color: rgb(131 131 131 / 76%);
    font-family: HelveticaNeue, sans-serif;
    position: relative;

    
}
html {
    height: 100%;
}
.form-container{
    align-items: center;
    margin: 10px auto 0px;
    display: flex;  
    box-sizing: border-box; 
    width: 800px;
}
.form{
    margin: auto; 
    padding: 20px;
}
body .form-container .form .para{
    margin-top: 10px;
    margin-bottom: 35px;
    padding: 0px;
}
.row {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    margin-bottom: 5px;
}
.column-left {
    width: 50%;
    display: flex;
    float: left;
}


.column-right {
    width: 50%;
    display: flex;
    float: right;
}

.column-add {
    width: 33%;
    display: flex;
    float: left;
    padding:auto;
}
.column-right-add {
    width: 33%;
    display: flex;
    float: right;
}
.column-middle-add {
    width: 33%;
    display: flex;
    justify-content: center;
    
}

input[type=text], textarea, select {
    padding: 0.8rem; 
    border: 1px solid rgb(133, 133, 133);  
    margin-top: 6px; 
    margin-bottom: 16px; 
    margin-right: 15px;
    width:100%;
    font-size: medium;
    font-weight: 300;
    
}
input[type=text]:hover{
    box-shadow: 0 0 0 2px rgb(64, 63, 63);  
}
input[type=email]:hover{
    box-shadow: 0 0 0 2px rgb(64, 63, 63);  
}
input[type=tel]:hover{
    box-shadow: 0 0 0 2px rgb(64, 63, 63);    
}
input[type=email], textarea, select {
    padding: 0.8rem; 
    border: 1px solid rgb(133, 133, 133);
    box-sizing: border-box; 
    margin-top: 6px; 
    margin-bottom: 16px; 
    margin-right: 15px;
    width:100%;
    font-size: medium;
    font-weight: 300;
}
input[type=tel], textarea, select {
    padding: 0.8rem; 
    border: 1px solid rgb(133, 133, 133); 
    box-sizing: border-box; 
    margin-top: 6px; 
    margin-bottom: 16px; 
    margin-right: 15px;
    width:100%;
    font-size: medium;
}



input[type="date" i], textarea {
    padding: 0.8rem; 
    border: 1px solid rgb(133, 133, 133);
    box-sizing: border-box; 
    margin-top: 6px; 
    margin-bottom: 16px; 
    margin-right: 15px;
    width:100%;
    color: #6c6565;
    font-size: medium;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 300;
}

select#Date-of-Purchase {
    color: rgba(84, 82, 82, 0.798);
}
select#Place-of-Purchase {
    color: rgba(84, 82, 82, 0.798);
}

.signup{
    margin-top: 10px;
    margin-bottom:10px;
    vertical-align: middle;
    display: inline-block;
}
.signup label{
    font-weight: 300;
}
input#signup {
    vertical-align: middle;
    width: 25px;
    height: 25px;
}
input[type=text]:focus {
    border-color:rgb(69, 69, 69);
}
input[type=submit] {
    padding:10px 65px; 
    background:rgba(107, 103, 101, 0.831); 
    border:0 none;
    cursor:pointer;
    border-radius: 30px; 
    color: white;
    margin-top: 35px;
}
p {
    font-family: system-ui;
    color: #6c6565;
}
.btn{
    align-items: center;
    display:flex;
    justify-content: center;
}
label {
    font-weight:600;
    color: rgba(84, 82, 82, 0.798);
    vertical-align: middle;
}
select {
    appearance: none;
    background: white;
    background-image: url("data:image/svg xml,");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    border-radius: 2px;
    color: #6c6565;
    
}
.policy-text{
    margin-top: 60px;
    margin-bottom: 120px;;
}
.danger{
    color: red;
    position: absolute;
    margin-left: 62px;
    margin-top: 15px;
    font-size: large;
    opacity: 1;
    pointer-events: none; 
    
}
input:focus   .danger { 
    display: none; 
} 
input:focus   .danger-surname { 
    display: none; 
} 
input:focus   .danger-address { 
    display: none; 
} 
input:focus   .danger-city { 
    display: none; 
} 
input:focus   .danger-email { 
    display: none; 
} 
input:focus   .danger-phone { 
    display: none; 
} 
input:focus   .danger-region { 
    display: none; 
} 
.danger .danger-surname .danger-address .danger-city .danger-email .danger-phone .danger-region :after{
    display: none!important;
    opacity: 0;
}
input::selection   #Hello{
    display: none;
}
input:focus::-webkit-input-placeholder  {color:transparent;}
input:focus::-moz-placeholder   {color:transparent;}
input:-moz-placeholder   {color:transparent;}
.danger-surname{
    color: red;
    position: absolute;
    margin-left: 82px;
    margin-top: 15px;
    font-size: large;
}
.danger-address{
    color: red;
    position: absolute;
    margin-left: 128px;
    margin-top: 15px;
    font-size: large;
}
.danger-city{
    color: red;
    position: absolute;
    margin-left: 48px;
    margin-top: 15px;
    font-size: large;
}
.danger-region{
    color: red;
    position: absolute;
    margin-left: 18px;
    margin-top: 15px;
    font-size: large;
}
.danger-email{
    color: red;
    position: absolute;
    margin-left: 60px;
    margin-top: 15px;
    font-size: large;
}
.danger-phone{
    color: red;
    position: absolute;
    margin-left: 230px;
    margin-top: 15px;
    font-size: large;
}
::-webkit-input-placeholder { opacity: 1; -webkit-transition: opacity .5s; transition: opacity .5s; }  /* Chrome <=56, Safari < 10 */
:-moz-placeholder { opacity: 1; -moz-transition: opacity .5s; transition: opacity .5s; } /* FF 4-18 */
::-moz-placeholder { opacity: 1; -moz-transition: opacity .5s; transition: opacity .5s; } /* FF 19-51 */
:-ms-input-placeholder { opacity: 1; -ms-transition: opacity .5s; transition: opacity .5s; } /* IE 10  */
::placeholder { opacity: 1; transition: opacity .5s; } /* Modern Browsers */
*:focus::-webkit-input-placeholder { opacity: 0; } /* Chrome <=56, Safari < 10 */
*:focus:-moz-placeholder { opacity: 0; } /* FF 4-18 */
*:focus::-moz-placeholder { opacity: 0; } /* FF 19-50 */
*:focus:-ms-input-placeholder { opacity: 0; } /* IE 10  */
*:focus::placeholder { opacity: 0; } /* Modern Browsers */

/* media queries */
@media only screen and (max-width: 600px) {
.column-left, .column-right,.column-add,.column-middle-add, .column-right-add,.row {
    width: 100%;
    flex-direction: column;
    display: flex;                   
}
.danger-region{
    margin-left: 125px;
    margin-top: -25px;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Register</title>
<link rel="stylesheet" href="style.css">

</head>
<body>
    <div > 
        <div >
            <div >
                
            </div>
            <form action="#">
                <div >
                    <label>Name</label>
                </div>
                <div >
                    <div >
                        <input type="text"  id="name" placeholder="Name" required ><span >*</span>
                    </div>
                    <div >
                        <input type="text"  id="surname" placeholder="Surname" required><span >*</span>
                    </div> 
                </div>
                <div >
                    <label>Address</label>
                </div>
                <div >
                    <input type="text" id="name" placeholder="Address Line 1" required><span >*</span>
                </div>
                <div >
                    <input type="text" id="name" placeholder="Address Line 2">
                </div>
                <div >
                    <div >
                        <input type="text" id="name" placeholder="City" required><span >*</span>
                    </div>
                    <div >
                        <input type="text" id="name" placeholder="Region / State" required><span >*</span>
                    </div>
                    <div >
                        <input type="text" id="name" placeholder="Post Code / Zip">
                    </div>  
                </div>
                <div >
                    <label>Contact</label>
                </div>
                <div >
                    <div >
                        <input name="email" type="email" id="email" placeholder="Email" required><span >*</span>
                    </div>
                    <div >
                        <input type="tel" id="tel" placeholder="Phone No (incl. country code)" required><span >*</span>
                    </div>
                </div>
                <div >
                    <input type="checkbox" name="signup" id="signup" alt="Sign" placeholder="signup"> <label> Sign</label>
                </div>
                <div >
                    <div >
                        <label>Product</label>
                    </div>
                    <div >
                        <label>Date of Purchase</label>
                    </div>
                    
                </div>
                <div >
                    <div ><p id="Hello" style="color: red; margin-right: 120px; position: absolute; margin-left: 162px;font-size: large;"></p>
                        <select aria-lebel="products" name="Select-Product" id="products"  form="register-form" required>
                            <option value="" disabled selected hidden>Select Your Product</option>
                            <option value="Product 1">Product 1</option>
                            <option value="Product 2">Product 2</option>
                            <option value="Product 3">Product 3</option>
                            <option value="Product 4">Product 4</option>
                        </select>
                    </div>
                    <div >
                        <label for="purchase-date"></label>
                        <input type="date" id="purchase-date" placeholder="" name="purchase-date" value="2018-07-22" required>
                    </div>
                </div>
                <div >
                    <label>Place of Purchase</label>
                </div>
                <div >
                    <div >
                        <select id="Place-of-Purchase" name="Place of Purchase" form="register-form">
                            <option value="Place of Purchase" disabled selected hidden>hey</option>
                            <option value="Option 1">Option 1</option>
                            <option value=""></option>
                            <option value="Option 3">Option 3</option>
                            <option value="Option 4">Option 4</option>
                        </select>
                    </div>
                </div>
                <div >
                    <input type="submit" style="align-items: center;" value="Submit">
                </div>
            </form>
            <div >
                <p>For more about how we use your information, please see our Privacy Policy.</p>
            </div> 
        </div>
    </div>
    <!-- asterisk for select-products -->
    <script>
        document.getElementById("Hello").innerHTML = "*";
        let element = document.getElementById(title);
        alert(element.href);
    </script>      
</body>
</html>

CodePudding user response:

You can use outline for that. Simple change border: 2px solid; into outline: 2px solid; or you can use box-shadow to maintain the border-radius of element

body{
    color: rgb(131 131 131 / 76%);
    font-family: HelveticaNeue, sans-serif;
    position: relative;

    
}
html {
    height: 100%;
}
.form-container{
    align-items: center;
    margin: 10px auto 0px;
    display: flex;  
    box-sizing: border-box; 
    width: 800px;
}
.form{
    margin: auto; 
    padding: 20px;
}
body .form-container .form .para{
    margin-top: 10px;
    margin-bottom: 35px;
    padding: 0px;
}
.row {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    margin-bottom: 5px;
}
.column-left {
    width: 50%;
    display: flex;
    float: left;
}


.column-right {
    width: 50%;
    display: flex;
    float: right;
}

.column-add {
    width: 33%;
    display: flex;
    float: left;
    padding:auto;
}
.column-right-add {
    width: 33%;
    display: flex;
    float: right;
}
.column-middle-add {
    width: 33%;
    display: flex;
    justify-content: center;
    
}

input[type=text], textarea, select {
    padding: 0.8rem; 
    border: 1px solid rgb(133, 133, 133);  
    margin-top: 6px; 
    margin-bottom: 16px; 
    margin-right: 15px;
    width:100%;
    font-size: medium;
    font-weight: 300;
    
}

input[type=text]:hover{
    outline: 2px solid black;
}
input[type=email]:hover{
    outline: 2px solid black;
}
input[type=tel]:hover{
    outline: 2px solid black;
}

input[type=email], textarea, select {
    padding: 0.8rem; 
    border: 1px solid rgb(133, 133, 133);
    box-sizing: border-box; 
    margin-top: 6px; 
    margin-bottom: 16px; 
    margin-right: 15px;
    width:100%;
    font-size: medium;
    font-weight: 300;
}
input[type=tel], textarea, select {
    padding: 0.8rem; 
    border: 1px solid rgb(133, 133, 133); 
    box-sizing: border-box; 
    margin-top: 6px; 
    margin-bottom: 16px; 
    margin-right: 15px;
    width:100%;
    font-size: medium;
}

input[type="date" i], textarea {
    padding: 0.8rem; 
    border: 1px solid rgb(133, 133, 133);
    box-sizing: border-box; 
    margin-top: 6px; 
    margin-bottom: 16px; 
    margin-right: 15px;
    width:100%;
    color: #6c6565;
    font-size: medium;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 300;
}

select#Date-of-Purchase {
    color: rgba(84, 82, 82, 0.798);
}
select#Place-of-Purchase {
    color: rgba(84, 82, 82, 0.798);
}

.signup{
    margin-top: 10px;
    margin-bottom:10px;
    vertical-align: middle;
    display: inline-block;
}
.signup label{
    font-weight: 300;
}
input#signup {
    vertical-align: middle;
    width: 25px;
    height: 25px;
}
input[type=text]:focus {
    border-color:rgb(69, 69, 69);
}
input[type=submit] {
    padding:10px 65px; 
    background:rgba(107, 103, 101, 0.831); 
    border:0 none;
    cursor:pointer;
    border-radius: 30px; 
    color: white;
    margin-top: 35px;
}
p {
    font-family: system-ui;
    color: #6c6565;
}
.btn{
    align-items: center;
    display:flex;
    justify-content: center;
}
label {
    font-weight:600;
    color: rgba(84, 82, 82, 0.798);
    vertical-align: middle;
}
select {
    appearance: none;
    background: white;
    background-image: url("data:image/svg xml,");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    border-radius: 2px;
    color: #6c6565;
    
}
.policy-text{
    margin-top: 60px;
    margin-bottom: 120px;;
}
.danger{
    color: red;
    position: absolute;
    margin-left: 62px;
    margin-top: 15px;
    font-size: large;
    opacity: 1;
    pointer-events: none; 
    
}
input:focus   .danger { 
    display: none; 
} 
input:focus   .danger-surname { 
    display: none; 
} 
input:focus   .danger-address { 
    display: none; 
} 
input:focus   .danger-city { 
    display: none; 
} 
input:focus   .danger-email { 
    display: none; 
} 
input:focus   .danger-phone { 
    display: none; 
} 
input:focus   .danger-region { 
    display: none; 
} 
.danger .danger-surname .danger-address .danger-city .danger-email .danger-phone .danger-region :after{
    display: none!important;
    opacity: 0;
}
input::selection   #Hello{
    display: none;
}
input:focus::-webkit-input-placeholder  {color:transparent;}
input:focus::-moz-placeholder   {color:transparent;}
input:-moz-placeholder   {color:transparent;}
.danger-surname{
    color: red;
    position: absolute;
    margin-left: 82px;
    margin-top: 15px;
    font-size: large;
}
.danger-address{
    color: red;
    position: absolute;
    margin-left: 128px;
    margin-top: 15px;
    font-size: large;
}
.danger-city{
    color: red;
    position: absolute;
    margin-left: 48px;
    margin-top: 15px;
    font-size: large;
}
.danger-region{
    color: red;
    position: absolute;
    margin-left: 18px;
    margin-top: 15px;
    font-size: large;
}
.danger-email{
    color: red;
    position: absolute;
    margin-left: 60px;
    margin-top: 15px;
    font-size: large;
}
.danger-phone{
    color: red;
    position: absolute;
    margin-left: 230px;
    margin-top: 15px;
    font-size: large;
}
::-webkit-input-placeholder { opacity: 1; -webkit-transition: opacity .5s; transition: opacity .5s; }  /* Chrome <=56, Safari < 10 */
:-moz-placeholder { opacity: 1; -moz-transition: opacity .5s; transition: opacity .5s; } /* FF 4-18 */
::-moz-placeholder { opacity: 1; -moz-transition: opacity .5s; transition: opacity .5s; } /* FF 19-51 */
:-ms-input-placeholder { opacity: 1; -ms-transition: opacity .5s; transition: opacity .5s; } /* IE 10  */
::placeholder { opacity: 1; transition: opacity .5s; } /* Modern Browsers */
*:focus::-webkit-input-placeholder { opacity: 0; } /* Chrome <=56, Safari < 10 */
*:focus:-moz-placeholder { opacity: 0; } /* FF 4-18 */
*:focus::-moz-placeholder { opacity: 0; } /* FF 19-50 */
*:focus:-ms-input-placeholder { opacity: 0; } /* IE 10  */
*:focus::placeholder { opacity: 0; } /* Modern Browsers */

/* media queries */
@media only screen and (max-width: 600px) {
.column-left, .column-right,.column-add,.column-middle-add, .column-right-add,.row {
    width: 100%;
    flex-direction: column;
    display: flex;                   
}
.danger-region{
    margin-left: 125px;
    margin-top: -25px;
}
}
            <form action="#">
                <div >
                    <label>Name</label>
                </div>
                <div >
                    <div >
                        <input type="text"  id="name" placeholder="Name" required ><span >*</span>
                    </div>
                    <div >
                        <input type="text"  id="surname" placeholder="Surname" required><span >*</span>
                    </div> 
                </div>
                <div >
                    <label>Address</label>
                </div>
                <div >
                    <input type="text" id="name" placeholder="Address Line 1" required><span >*</span>
                </div>
                <div >
                    <input type="text" id="name" placeholder="Address Line 2">
                </div>
                <div >
                    <div >
                        <input type="text" id="name" placeholder="City" required><span >*</span>
                    </div>
                    <div >
                        <input type="text" id="name" placeholder="Region / State" required><span >*</span>
                    </div>
                    <div >
                        <input type="text" id="name" placeholder="Post Code / Zip">
                    </div>  
                </div>
                <div >
                    <label>Contact</label>
                </div>
                <div >
                    <div >
                        <input name="email" type="email" id="email" placeholder="Email" required><span >*</span>
                    </div>
                    <div >
                        <input type="tel" id="tel" placeholder="Phone No (incl. country code)" required><span >*</span>
                    </div>
                </div>
                <div >
                    <input type="checkbox" name="signup" id="signup" alt="Sign" placeholder="signup"> <label> Sign</label>
                </div>
                <div >
                    <div >
                        <label>Product</label>
                    </div>
                    <div >
                        <label>Date of Purchase</label>
                    </div>
                    
                </div>
                <div >
                    <div ><p id="Hello" style="color: red; margin-right: 120px; position: absolute; margin-left: 162px;font-size: large;"></p>
                        <select aria-lebel="products" name="Select-Product" id="products"  form="register-form" required>
                            <option value="" disabled selected hidden>Select Your Product</option>
                            <option value="Product 1">Product 1</option>
                            <option value="Product 2">Product 2</option>
                            <option value="Product 3">Product 3</option>
                            <option value="Product 4">Product 4</option>
                        </select>
                    </div>
                    <div >
                        <label for="purchase-date"></label>
                        <input type="date" id="purchase-date" placeholder="" name="purchase-date" value="2018-07-22" required>
                    </div>
                </div>
                <div >
                    <label>Place of Purchase</label>
                </div>
                <div >
                    <div >
                        <select id="Place-of-Purchase" name="Place of Purchase" form="register-form">
                            <option value="Place of Purchase" disabled selected hidden>hey</option>
                            <option value="Option 1">Option 1</option>
                            <option value=""></option>
                            <option value="Option 3">Option 3</option>
                            <option value="Option 4">Option 4</option>
                        </select>
                    </div>
                </div>
                <div >
                    <input type="submit" style="align-items: center;" value="Submit">
                </div>
            </form>
 

CodePudding user response:

input[type=text]:focus {

border: 3px solid red; }

CodePudding user response:

don't change the border width on hover instead use the outline property https://developer.mozilla.org/en-US/docs/Web/CSS/outline

outline:rgb(64, 63, 63) solid 2px; 

  • Related