简体   繁体   English

输入元素的底部边框被破坏

[英]Bottom border is broken for input elements

I'm trying to create a form with input,textarea elements and everything works fine in normal mode and when we change the background-color to black and color to white (for dark mode) it appears a bit strange like below.我正在尝试创建一个带有输入、textarea 元素的表单,并且在正常模式下一切正常,当我们将背景颜色更改为黑色并将颜色更改为白色(对于暗模式)时,它看起来有点奇怪,如下所示。 The bottom edge is not visible at start.底部边缘在开始时不可见。 I'm not sure why this behavior exists.我不确定为什么存在这种行为。 I have added to not allow user agent stylesheets default applied.我添加了不允许默认应用用户代理样式表。 暗模式输入元件

Remaining elements work as expected other than input elements.除输入元素外,其余元素按预期工作。

These are the CSS styles applied这些是应用的 CSS styles

   input,textarea {
        width : 100%;
        border: 1px solid silver;
        padding-top: 10px;
        padding-bottom: 10px;
    }

.ncolor{
    color : black;
    background-color: white;
}

.nmcolor{
    color : white;
    background-color: black;
}

用户代理样式表自动应用

普通模式输入元件

Below is the HTML snippet where we are applying the css file.下面是 HTML 片段,我们在其中应用 css 文件。

<form>
     <label class="nmcolor" htmlFor='Name'>Name : </label>
     <textarea rows="0" class="nmcolor" type='text'></textarea>
     <label class="nmcolor" htmlFor='Email'>Email : </label> 
     <input class="nmcolor" type='email'></input>
     <label class="nmcolor" htmlFor='Message'>Message : </label> 
     <textarea class="nmcolor" rows="20"></textarea>
     <button type="submit">Send</button>
   </form>

Can you share your code?你能分享你的代码吗? This issue can have something to do with applied border-radius on your input element.此问题可能与输入元素上应用的边框半径有关。

Thanks guys, Adding margin-bottom property for the input elements resolved the issue.谢谢大家,为输入元素添加 margin-bottom 属性解决了这个问题。

input,textarea {
    width : 100%;
    border: 1px solid silver;
    padding-top: 10px;
    padding-bottom: 10px;
    margin-bottom: 3px;    /* this one */
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM