html – 如何选择没有“类型”与CSS

前端之家收集整理的这篇文章主要介绍了html – 如何选择没有“类型”与CSS前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在这里有3<输入>在我的 HTML
Name: <input><br>
Age: <input type="number"><br>
Site: <input type="url">

我可以用这些CSS选择底部的两个:

input[type="number"]{
    color: gray;
}
input[type="url"]{
    color: blue;
}

但是我不知道如何选择没有类型的第一个.
我试过了:

input{
    color: red;
}

但它会改变另外两个.

input[type=""]{
    color: red;
}

这还不行.
任何想法?

解决方法

选择器输入[type =“”]将查找具有设置为空的属性类型的输入.尝试使用这个:
input:not([type]) { }

See the jsFiddle.

原文链接:https://www.f2er.com/html/230801.html

猜你在找的HTML相关文章