html - 无法使占位符输入文本消失

标签 html css

所以我有一个表单,我设法让所有占位符输入文本淡出,除了评论框,除非我定义评论框 input type="text"然后它得到与其他字段相同的设计。这是我的 contact-form-7 插件中的内容:

<style>
input[type="email"]::-webkit-input-placeholder  {
  -webkit-transition: opacity 0.3s linear; 
  color: gray;
}

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

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

input[type="text"]:focus::-webkit-input-placeholder  {
  opacity: 0;
}

</style>
<center> 

<label for=".elementor-6 .elementor-element.elementor-element-5m0lukt .wpcf7 input[type="text"]"><input type=text text* 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" tel* tel-196 input placeholder="טלפון" id:phone required</input></label>

<label for=".wpcf7-form-control.wpcf7-text.wpcf7-email.wpcf7-validates-as-required.wpcf7-validates-as-email"]"><input type=email email* your-email placeholder="אימייל" ID:email </input></label>

[textarea details id:details class:details placeholder="ההודעה שלכם"]

[submit "דברו איתנו"]
</center>

这是相关的 CSS:

.wpcf7-form-control.wpcf7-submit {
  width: 20% !important;
  text-align: center !important;
  background-color: #316e35 !important;
  color: white !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: 158.5px;
}

@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: 20% !important;
  text-align: center !important;
  letter-spacing: 4px;
  background-color: white !important;
  color: #316e35 !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: 158.5px;
}

[placeholder]:focus {
  background-color: rgba(221,221,221,0.8);
  transition: opacity 0.5s 0.5s ease;
  font-family: open sans hebrew condensed;
  font-style: italic;
}

body .cf7-style input[type=”text”]:focus,
body .cf7-style input[type=”email”]:focus,
body .cf7-style textarea:focus {
  background: #f9f9f9;
  color: black;
}

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: #333333 !important;
  margin: 0 auto;
  text-align: center !important;
  border-radius: 999em !important;
  display: inline-block;
  left: auto;
  right: auto;
  font-family: open sans hebrew condensed !important;
  font-style: italic;
  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 #316e35 !important;
  box-shadow: 0 0 10px #719ECE !important;
  min-width: 164px;
}

#mc_embed_signup .mc-field-group{
  width:100% !important}


#details.wpcf7-form-control.wpcf7-textarea.details {
  width: 40%;
  Height: 150px;
  background-color: rgba(255,255,255,0.8) !important;
  color: #333333 !important;
  margin: 0 auto;
  text-align: center !important;
  display: inline-block;
  left: auto;
  right: auto;
  font-family: open sans hebrew condensed !important;
  font-style: italic;
  min-width: 200px;}

#details.wpcf7-form-control.wpcf7-textarea.details:focus {
  background-color: rgba(221,221,221,0.8) !important;
  font-family: open sans hebrew condensed !important;
  font-style: italic !important;
  border: 2px solid #316e35 !important;
  box-shadow: 0 0 10px #719ECE !important;
  min-width: 200px;
  transition: opacity 0.5s 0.5s ease !important;
  -webkit-transition: opacity 0.3s linear !important; 
  color: gray;

}

您可以在以下链接中查看表格:www.walterbar.co.il 它位于页面的最底部,对于奇怪的语言,我深表歉意。

所以就像我说的,我想保留当前的设计,但让评论框(第四字段)内的文本像其他字段一样消失。它仅在我将输入类型定义为文本时才有效,但随后它会强制采用与其余字段相同的设计。 提前致谢!

最佳答案

根据我通过查看链接中的表格所理解的,您所说的已应用的占位符实际上设置为 textarea 的值,这就是为什么必须在输入数据之前将其删除的原因。 你试过下面的那个吗?

<textarea id="details" class="details" placeholder="ההודעה שלכם"></textarea>

关于html - 无法使占位符输入文本消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43448503/

相关文章:

javascript - 离开 Hover 时的事件

android - Fancybox:无法在 Android 手机上滚动

javascript - 在 Safari/Mac 的页面上嵌入谷歌地图时出现奇怪的重绘(?)问题

javascript - 用重复的线性渐变颜色填充 SVG 元素

html - CSS 位置内容/选项下拉列表

javascript - 使用日期选择器向表添加行

java - 如何从列表生成java类中的动态表

javascript - 我想在使用图像模式后禁用元素

javascript - 使下拉菜单在单击 JavaScript 时消失

php - 如何在html输入文本中保存值