Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

input top border disappears in windows chrome

Tags:

html

css

code

<div class="center">
  <div class="parent">
    <label>姓名</label>
    <input type="text">
  </div>
</div>


.center {
  transform: translate(-50%, -50%);
  position: absolute;
  top: 50%;
  left: 50%;
}

.parent {
  padding: 8px 0;
}
label {
  margin-left:  20px;
}
input {
  width: 100px;
  height: 41px;
}

I want to know why the top border of the input disappears.I would be appreciated if someone answers me.

os: win10

browser: chrome 51.0.2704.84m

Thanks.

like image 744
Hsu Lee Avatar asked Feb 10 '17 03:02

Hsu Lee


People also ask

How do I get rid of the input focus border in Chrome?

Answer: Use CSS outline property In Google Chrome browser form controls like <input> , <textarea> and <select> highlighted with blue outline around them on focus. This is the default behavior of chrome, however if you don't like it you can easily remove this by setting their outline property to none .

How do I make my input box border invisible?

border: none transparent; outline: none; This will not only remove the border around the input field but also the orange highlight when the input is in focus. +1 outline:none makes the border disappear even when the input is focused.

How do you put a border on an input box in HTML?

You can use the CSS border property to add a border around your HTML textboxes. You can also use border-width , border-style , and border-color , but the border property covers all of these anyway.


1 Answers

The problem is occurring because of transform: translate(-50%, -50%);

You can modify your css to removing transform

.center {
   position: relative;
   width: 100%;
}
.parent {
   padding: 8px 0;
   margin: 15% auto;
   width: 100px;
}
label {
  margin-left:  20px;
}
input {
  width: 100px;
  height: 41px;
}
like image 168
Akash Ryan Avatar answered Oct 06 '22 01:10

Akash Ryan