2017-03-03 70 views
-1

問題是我有需要的輸入,我有一些:當我嘗試發送值空的邊框紅色從所需的顯示和doenst點擊它時,我點擊它,所以我有一個從重點和紅色邊框奇怪的綠色邊框的需要可以約1幫我刪除所需要的點擊後輸入重點和要求

\t \t \t \t .form-login { 
 
\t \t \t \t \t width : 400px; 
 
\t \t \t \t \t height: auto; 
 
\t \t \t \t \t position : absolute; 
 
\t \t \t \t \t padding : 10px 25px; 
 
\t \t \t \t \t background-color: #ddd; 
 
\t \t \t \t \t left: 50%; 
 
\t \t \t \t \t top: 50%; 
 
\t \t \t \t \t transform: translateX(-50%) translateY(-50%); 
 
\t \t \t \t \t border: none; 
 
\t \t \t \t \t border-top-right-radius: 5px; 
 
\t \t \t \t \t border-top-left-radius: 5px; 
 
\t \t \t \t } 
 
\t \t \t \t .forminputs{ 
 
\t \t \t \t \t width : 100%; 
 
\t \t \t \t \t position : relative; 
 
\t \t \t \t \t margin :25px auto; 
 
\t \t \t \t } 
 
\t \t \t \t .input { 
 
\t \t \t \t \t width: 100%; 
 
\t \t \t \t \t height: 50px; 
 
\t \t \t \t \t background:gray; 
 
\t \t \t \t \t position: relative; 
 
\t \t \t \t \t margin:15px auto; 
 
\t \t \t \t } 
 
\t \t \t \t input[type="text"], 
 
\t \t \t \t input[type="password"]{ 
 
\t \t \t \t \t width:100%; 
 
\t \t \t \t \t height:50px; 
 
\t \t \t \t \t position: relative; 
 
\t \t \t \t \t outline :none; 
 
\t \t \t \t \t border:1px solid gray; 
 
\t \t \t \t \t border-radius: 3px; 
 
\t \t \t \t \t font-size:16px; 
 
\t \t \t \t \t font-family: 'Questrial',sans-serif; 
 
\t \t \t \t \t padding-left: 30px; 
 
    \t \t \t \t  -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ 
 
        -moz-box-sizing: border-box; /* Firefox, other Gecko */ 
 
    \t \t \t \t  box-sizing: border-box;   /* Opera/IE 8+ */ 
 
\t \t \t \t } 
 
\t \t \t \t input[type="text"]:focus, input[type="password"]:focus{ 
 
\t \t \t \t \t border:2px solid #50C878; 
 
\t \t \t \t } 
 
\t \t \t \t input[type="submit"]{ 
 
\t \t \t \t \t position: relative; 
 
\t \t \t \t \t background-color:#50C878; 
 
\t \t \t \t \t width : 100px; 
 
\t \t \t \t \t height : 40px; 
 
\t \t \t \t \t font-family: 'Questrial',sans-serif; 
 
\t \t \t \t \t text-transform: uppercase; 
 
\t \t \t \t \t color: #FFF; 
 
\t \t \t \t \t font-weight: bold; 
 
\t \t \t \t \t font-size: 17px; 
 
\t \t \t \t \t cursor: pointer; 
 
\t \t \t \t \t border: none; 
 
\t \t \t \t \t border-radius: 5px; 
 
\t \t \t \t \t float:right; 
 
\t \t \t \t \t margin-bottom: 20px; 
 
\t \t \t \t \t margin-top:10px; 
 
\t \t \t \t }
\t \t \t <form class="form" name="form" method="post" action="login-m.php"> 
 
\t \t \t \t <section class ="input"> 
 
\t \t \t \t \t <input type="text" name="utilizador" value="" placeholder="Insira o nome de utilizador" required/><br> 
 
\t \t \t \t \t <i class="fa fa-user"></i> 
 
\t \t \t \t </section> \t \t 
 
\t \t \t \t <section class ="input"> \t 
 
\t \t \t \t \t <input type="password" name="palavrachave" value="" placeholder="Insira a palavra-chave" required/><br> 
 
\t \t \t \t \t <i class="fa fa-lock"></i> 
 
\t \t \t \t </section> 
 
\t \t \t \t <a href="#">Esqueceu a palavra-chave ?</a><br> 
 
\t \t \t \t <input type="submit" name ="entrar" value="Entrar"><br> 
 
\t \t \t \t <p> Nome de Utilizador e/ou<br> Palavra-chave incorreto(s)</p> 
 
\t \t \t </form>

+0

你有沒有試過'輸入[required]:focus {}'?如果您的驗證過程爲您的輸入或其容器添加了類,那麼您是否嘗試過使用這些選擇器?你有沒有采取任何措施來解決問題,除了在[so]上尋求幫助? –

+0

沒有工作......不知道該怎麼辦 –

+0

您需要了解如何檢查和確定哪些選擇器將當前規則應用於您的元素。如果你想自己做這件事,那就沒有辦法。如果你不提供[mcve],我們也幫不了你。 –

回答

0

不是你的問題的完整解決方案,但這裏是一些有用的信息。

您可以在CSS中使用:required和:無效選擇器來更改這些對象的樣式。它們可以與其他選擇器鏈接,例如輸入:無效:焦點。這應該讓你修改樣式並刪除雙重發光邊框。

+0

':invalid'只適用於['Constraint validation'](https://developer.mozilla.org/en-US/docs/Web /指南/ HTML/HTML5/Constraint_validation)。目前大多數庫不使用它們進行驗證(因爲它們不是跨瀏覽器的),而是依賴於添加到表單元素的自定義類。 –