http://codepen.io/leongaban/pen/NqzxPR?editors=110
我有一个2输入的表单,一旦用户突出显示(B
)输入并开始输入,文本就会变为白色。
:focus
然而,在完成输入然后标签到下一个输入后,第一个输入失去了它的风格。什么是我需要的伪选择器,以确保第一个输入保持它body {
font-family: Arial, sans-serif;
background: #3D3D3D;
}
.login-form {
margin-top: 20px;
}
.login-form input {
margin-bottom: 20px;
width: 416px;
height: 40px;
font-size: em(20);
text-indent: 15px;
color: #656565;
background: #3D3D3D;
border: 1px solid #656565;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-transition: all 0.5s ease-out;
-ms-transition: all 0.5s ease-out;
-o-transition: all 0.5s ease-out;
transition: all 0.5s ease-out;
}
.login-form input[value], .login-form input:focus, .login-form input:active {
color: #fff;
border: 1px solid #fff;
}
input .login-form[value] {
color: #fff;
border: 1px solid #fff;
}
.login-btn {
padding: 12px 0;
width: 420px;
color: #00D88C;
background: #3D3D3D;
border: 2px solid #00D88C;
cursor: pointer;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-transition: all 0.5s ease-out;
-ms-transition: all 0.5s ease-out;
-o-transition: all 0.5s ease-out;
transition: all 0.5s ease-out;
}
.login-btn:hover {
color: #fff;
background: #00D88C;
}
样式?
有没有办法塑造'#34;未聚焦但填写完好的状态"一个输入?
答案 0 :(得分:2)
你这样做是错误的。
您希望占位符为灰色,文本为白色。
因此,用灰色设置占位符的样式,让白色成为主要的占位符。像这样:
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Initial connection attempt, this should succeed:");
RunCFRequest();
Console.WriteLine("Wait 70 minutes for next connection attempt...");
Thread.Sleep(70*60*1000);
Console.WriteLine("Second connection attempt, this one should reproduce the failure:");
try
{
RunCFRequest();
}
catch (Exception exc)
{
Console.WriteLine(exc.ToString());
}
Console.WriteLine("Performing another connection attempt after failure to verify we continue working:");
RunCFRequest();
Console.WriteLine("Demo complete. Press any key to exit.");
Console.ReadKey();
}
private static void RunCFRequest()
{
Console.WriteLine("Attempting connection at " + DateTime.Now);
var request = (HttpWebRequest) WebRequest.Create("https://up1.ca");
using (var response = request.GetResponse())
{
using (var responseStream = response.GetResponseStream())
{
using (var streamReader = new StreamReader(responseStream))
{
string recvd = streamReader.ReadToEnd();
Console.WriteLine("Successfully read stream, got " + recvd.Length + " bytes of data");
}
}
}
}
}