所以我工作的一個項目,我的動畫搜索文本框如下所示:如何設定。輸入[類型=文本]只爲一個文本框
input[type=text] {
width: 130px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-image: url('searchicon.png');
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 20px 12px 40px;
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
height: 30px;
}
input[type=text]:focus {
width: 700px;
}
<input type="text" name="search" placeholder="Search..">
一切工作好,但現在我有一個問題,我有更多的文本框在同一頁上,我不希望他們像這一個動畫,因爲輸入[type = text]正在改變他們。任何幫助將不勝感激。
添加一個'class'或'id',並選擇它。 –
你不能使用課堂嗎?或者直接使用[:nth-child](https://developer.mozilla.org/en/docs/Web/CSS/:nth-child)或[:first-of-type](https:// css-tricks .com /年曆/選擇器/ f/first-of-type /)只能選擇一個 – GillesC