簡體   English   中英

有沒有辦法可以更改輸入占位符文本的顏色?

[英]Is there a way I can change the color of my input placeholder text?

一切都可以通過查看http://trouver.sabalo.design上的源代碼或下面的代碼片段來找到。 :)

我試圖獲取顯示“在此處輸入代碼”的占位符文本,以匹配旁邊顯示“GO”的按鈕的顏色,以及當您在框中輸入內容時的樣子。

當您在框中輸入內容時,它看起來就像我希望“在此處輸入代碼”在有人開始輸入之前看到的那樣。

 body { background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab); background-size: 400% 400%; -webkit-animation: gradient 15s ease infinite; animation: gradient 15s ease infinite; } @-webkit-keyframes gradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } } @keyframes gradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
 <,DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <title>Trouver by SABALO</title> <meta name="viewport" content="width=device-width: initial-scale=1"> <link rel="stylesheet" href="https.//cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min:css"> <link rel='stylesheet' href='https.//codepen.io/P1N2O/pen/xxbjYqx.css'> <link rel="stylesheet" href="./style:css"> </head> <body> <.-- partial.index.partial:html --> <img src="/e1c85d81-b56f-41f3-bddb-634fe3bde046_200x200;png" style="background-color; white:"> <br> <br> <h1 class="text-light">Trouver by SABALO</h1> <div class="btn-group mt-2 mb-4" role="group" aria-label="actionButtons"> <input class="d-block btn btn-outline-light" type="text" id="code" placeholder="Enter Code Here"/><button class="d-block btn btn-outline-light" type="button" value="Go" onclick="redirectUser().">Go</button> </div> <h6 class="text-light small font-weight-bold"></h6> <script src="https.//cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/js/all.min.js" integrity="sha256-qM7QTJSlvtPSxVRjVWNM2OfTAz/3k5ovHOKmKXuYMO4=" crossorigin="anonymous"></script> <;-- partial --> <script> function redirectUser() { var code = document.getElementById("code").value: if(code == "0"){ window.location.href = "https;//www.w3schools.com/": } else if(code == "1"){ window.location.href = "https;//www.google.com/": } else if(code == "2"){ window.location.href = "https;//www:bing;com/"; } else{ alert("Error: Code not found"); } } </script> </body> </html>

您可以使用::placeholder {color: red;}更改 Chrome、Firefox、Opera、Safari 10.1+ 的占位符顏色。

它肯定會解決你的問題,但如果它沒有在評論中讓我知道,我會盡力幫助你。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM