【问题标题】:Input & Textarea Border not showing on SafariSafari 上不显示输入和文本区域边框
【发布时间】:2016-02-05 15:00:15
【问题描述】:

我的表单边框在除 Safari 之外的所有浏览器上都显示得很好。有时它们根本不出现,有时缺少一个边缘。任何帮助都是极好的。你可以去这里看看http://cmweb.design

这是html

    <section id="contact">

    <article>

      <h2 class="title1">Start Your Project</h2>
      <p>Reach out to see if we are the right fit for your project. We'd love to help see a vision come to reality.</p>

      <form method="POST" action="mail.php">
        <aside id="inputs">
          <input type="text" name="firstname" value="First Name" required><br>
          <input type="text" name="lastname" value="Last Name" required><br>
          <input type="email" name="email" value="Email" required><br>
        </aside>
        <textarea name="comments">Enter message here...</textarea>
        <button type="submit" value="Send">Submit</button>
      </form>

    </article>
    </section>

这是css:

*--- Contact ---*/

#contact{
  background-color: #181818;
  display: table;
  text-align: center;
  width: 100%;
}

#contact article{
  display: table-cell;
  padding: 100px;
  vertical-align: middle;
}

#contact h2{
  color: white;
  padding-bottom: 20px;
}

#contact p{
  font-size: 14px;
  margin: 0 auto;
  padding-bottom: 40px;
  width: 50%;
}

form{
  font-family: 'Raleway', sans-serif;
  -webkit-appearance: none;
}

#inputs{
  display: inline-block;
}

input{
  background-color: #181818;
  border-color: #cfcfcf;
  border-width: 0px 0px .5px 0px;
  border-radius: 0;
  -moz-border-radius: 0;
  -webkit-border-radius: 0;
  border-style: solid;
  color: #cfcfcf;;
  display: inline-block;
  font-family: 'Raleway', sans-serif;
  font-size: 15px;
  height: 25px;
  margin-right: 20px;
  margin-top: 21px;
  text-transform: uppercase;
  -webkit-appearance: none;
  width: 240px;
}

textarea{
  background-color: #181818;
  border-color: #cfcfcf;
  border-width: .5px;
  border-style: solid;
  border-radius: 0;
  -moz-border-radius: 0;
  -webkit-border-radius: 0;
  color: #cfcfcf;
  display: inline-block;
  font-family: 'Raleway', sans-serif;
  font-size: 15px;
  height: 120px;
  line-height: 25px;
  min-width: 305px;
  margin-top: 20px;
  padding: 5px 10px;
  text-transform: uppercase;
  width: 10%;
  -webkit-appearance: none;
  vertical-align: top;
}

button{
  background: none;
  border: .5px solid #cfcfcf;
  border-radius: 0;
  -moz-border-radius: 0;
  -webkit-border-radius: 0;
  color: white;
  display: inline-block;
  font-family: 'Raleway', sans-serif;
  font-size: 15px;
  margin-left: 20px;
  margin-top: 20px;
  padding: 50px 40px;
  position: relative;
  text-transform: uppercase;
  vertical-align: top;
}

button::after{
  border-top: 70px solid rgba(101,70,84,0.5);
  content: "";
  top: 25px; right: 0;left: 0;
  position: absolute;
  -webkit-transition: all .4s ease;
  -moz-transition: all .4s ease;
  -ms-transition: all .4s ease;
  -o-transition: all .4s ease;
  transition: all .4s ease;
}

button:hover::after{
  border-top: 70px solid rgba(227,228,217,0.5);
  content: "";
  top: 25px; right: 0; left: 0;
  position: absolute;
}

【问题讨论】:

    标签: html css forms safari border


    【解决方案1】:

    将边框宽度 0.5 更改为 1

    没有半个像素这样的单位:)

    最小值为 1px,显然有些浏览器将其四舍五入为 1,而其他浏览器则四舍五入为 0px。

    HTML: Sub-pixel border.

    input{
      background-color: #181818;
      border-color: #cfcfcf;
      border-width: 0px 0px 1px 0px;
      border-radius: 0;
      -moz-border-radius: 0;
      -webkit-border-radius: 0;
      border-style: solid;
      color: #cfcfcf;;
      display: inline-block;
      font-family: 'Raleway', sans-serif;
      font-size: 15px;
      height: 25px;
      margin-right: 20px;
      margin-top: 21px;
      text-transform: uppercase;
      -webkit-appearance: none;
      width: 240px;
    }
    
    textarea{
      background-color: #181818;
      border-color: #cfcfcf;
      border-width: 1px;
      border-style: solid;
      border-radius: 0;
      -moz-border-radius: 0;
      -webkit-border-radius: 0;
      color: #cfcfcf;
      display: inline-block;
      font-family: 'Raleway', sans-serif;
      font-size: 15px;
      height: 120px;
      line-height: 25px;
      min-width: 305px;
      margin-top: 20px;
      padding: 5px 10px;
      text-transform: uppercase;
      width: 10%;
      -webkit-appearance: none;
      vertical-align: top;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-08-01
      • 2019-04-04
      • 2021-12-13
      • 2010-10-30
      • 2012-01-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多