【问题标题】:Vertical Form Fields Acting Weird垂直表单字段表现怪异
【发布时间】:2017-10-06 04:43:18
【问题描述】:

我使用 Contact Form 7 创建了一个垂直表单,代码如下:

input[type="phone"]::-webkit-input-placeholder {
    -webkit-transition: opacity 0.3s linear;
    color: black;
  }
  
  input[type="phone"]:focus::-webkit-input-placeholder {
    opacity: 0;
  }
}
input[type="text"]::-webkit-input-placeholder {
  -webkit-transition: opacity 0.3s linear;
  color: black;
}
input[type="text"]:focus::-webkit-input-placeholder {
  opacity: 0;
}

.wpcf7-form-control.wpcf7-submit {
  width: 40% !important;
  text-align: center !important;
  background-color: #ff6600 !important;
  color: #0E1428 !important;
  font-family: open sans hebrew condensed;
  font-size: 20px;
  font-style: normal !important;
  font-weight: 900;
  border: 0;
  border-radius: 100em;
  display: inline-block;
  left: auto;
  right: auto;
  overflow: hidden;
  min-width: 250px;
}

@keyframes bounce {
  0%,
  20%,
  60%,
  100% {
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }
  40% {
    -webkit-transform: translateY(-20px);
    transform: translateY(-20px);
  }
  80% {
    -webkit-transform: translateY(-10px);
    transform: translateY(-10px);
  }
}

input[type="submit"]:hover {
  width: 40% !important;
  text-align: center !important;
  letter-spacing: 4px;
  background-color: #0E1428 !important;
  color: #ff6600 !important;
  font-family: open sans hebrew condensed;
  font-size: 20px;
  font-style: normal !important;
  font-weight: 900;
  animation: bounce 1s;
  border: 0;
  border-radius: 100em;
  display: inline-block;
  left: auto;
  right: auto;
  overflow: hidden;
  min-width: 250px;
}

body .cf7-style input[type=”text”]:focus,
body .cf7-style input[type=”email”]:focus,
body .cf7-style textarea:focus {
  transition: opacity 0.5s 0.5s ease !important;
  opacity: 0 !important;
}

[placeholder]:focus::-webkit-input-placeholder {
  transition: opacity 0.5s 0.5s ease;
  opacity: 0;
}

[placeholder] {
  width: 25% !important;
  background-color: rgba(255, 255, 255, 0.8) !important;
  height: 40px !important;
  color: black !important;
  margin: 0 auto;
  text-align: center !important;
  border-radius: 10px !important;
  display: inline-block;
  left: auto;
  right: auto;
  font-family: open sans hebrew condensed !important;
  font-style: italic;
  border: 2px solid #0E1428 !important;
  min-width: 164px;
}

[placeholder]:focus {
  background-color: rgba(221, 221, 221, 0.8) !important;
  transition: opacity 0.5s 0.5s ease !important;
  font-family: open sans hebrew condensed !important;
  font-style: italic !important;
  border: 2px solid #ff6600 !important;
  box-shadow: 0 0 10px #719ECE !important;
  min-width: 164px;
}
<center>

  <label for=".elementor-6 .elementor-element.elementor-element-5m0lukt .wpcf7 input[type=" text "]"><input type=text textarea name="your-name" placeholder="שם" required id:name </input></label> <label for=".wpcf7-form-control.wpcf7-text.wpcf7-tel.wpcf7-validates-as-required.wpcf7-validates-as-tel* your-email"> <input type="phone" textarea name="your-phone" input placeholder="טלפון" id:phone required</input></label>  [submit "!אני רוצה עוד פרטים"]
</center>

【问题讨论】:

  • 无法复制问题。您在哪个浏览器上看到此行为?
  • 您好,感谢您的帮助。 Chrome,这是一个临时链接:berko.createak.co.il

标签: html css wordpress forms shortcode


【解决方案1】:

我检查了给出的链接,您的输入似乎都使用了不同的样式

首先在您的 HTML 中,左侧输入为type="text",右侧为type="phone"。不确定这是否正确。

如果这是正确的,那么您可以调整您的 CSS。似乎很少有样式不适用于type="phone" 的输入,并且由于样式的差异,正确的样式看起来不同。

form input[type="text"], form input[type="password"], form input[type="email"], form input[type="url"], form input[type="date"], form input[type="month"], form input[type="time"], form input[type="datetime"], form input[type="datetime-local"], form input[type="week"], form input[type="number"], form input[type="search"], form input[type="tel"], form input[type="color"], form select, form textarea {
 ....
}

在上面的 CSS 中,如果添加 form input[type="phone"],第二个应该也能正常运行。

在 HTML 中将第二个输入更改为 type="tel" 以修复(在这种情况下不更改 CSS)

<input type="tel" textarea name="your-phone" input placeholder="טלפון" id:phone required</input>

【讨论】:

  • 所以左边是“name”,右边是“phone”,所以左边有输入:type="text"。右边有输入:type="phone"。
  • 左边是type="text",很少有样式只应用于文本而不是type="phone"。只需在上面显示的 CSS 中添加 form input[type="phone"]
  • 我已经编辑了答案,您也可以将第二个输入更改为type="tel" 以在不更改任何 CSS 的情况下进行修复
猜你喜欢
  • 1970-01-01
  • 2017-12-15
  • 2012-10-28
  • 1970-01-01
  • 1970-01-01
  • 2016-12-16
  • 1970-01-01
  • 2015-07-21
  • 2017-12-13
相关资源
最近更新 更多