样式占位符文本--输入日期标签

问题描述 投票:0回答:1

如果我们使用输入日期标签,就会显示这种格式。

enter image description here

我只是想隐藏 "日" 中的日期输入。于是我这样做了。它就消失了。

input::-webkit-datetime-edit-day-field{
    display: none;
}

问题是

它显示额外的破折号 "" 符号有。我只是想把这个也去掉。

我使用css first child这样的,并尝试针对第一个孩子,但它不工作。

input::-webkit-datetime-edit-fields-wrapper ::-webkit-datetime-edit-text:first-child {
    display: none;
}

有什么办法可以隐藏这个?https:/jsfiddle.netmdoty2g9

enter image description here

html jquery css contact-form-7
1个回答
0
投票

Finlay 我自己找到了一个解决办法。我把""完全隐藏起来。

input::-webkit-datetime-edit-text{
 display: none;
}

然后用 persudo css 这样放在输入框内。

input{
 position: relative;
}

input:after {
 content: "/";
 position: absolute;
 left: 60px;
 top: 1px;
}

enter image description here

问题解决了


-2
投票

<!DOCTYPE html>
<html>
<body>

<h1>Show a Date Control</h1>

<form action="/action_page.php">
  <label for="birthday">Birthday:</label>
  <input type="date" id="birthday" name="birthday">
  <input type="submit">
</form>

<p><strong>Note:</strong> type="date" is not supported in Safari or Internet Explorer 11 (or earlier).</p>

</body>
</html>
© www.soinside.com 2019 - 2024. All rights reserved.