百度CSS搜索框的寫法通常涉及到HTML和CSS兩個(gè)方面的知識(shí),在HTML中,我們可以使用<input>標(biāo)簽來(lái)創(chuàng)建一個(gè)搜索框,然后通過(guò)CSS來(lái)定制它的樣式,以下是一個(gè)簡(jiǎn)單的示例:
HTML部分:
<div class="search-box"> <input type="text" class="search-input" placeholder="請(qǐng)輸入搜索關(guān)鍵詞"> <button class="search-button">搜索</button> </div>
CSS部分:
.search-box { width: 300px; margin: 20px auto; padding: 10px; border: 1px solid #ccc; border-radius: 5px; } .search-input { width: 100%; padding: 10px; border: none; border-radius: 5px; } .search-button { width: 100px; height: 30px; margin-top: 10px; padding: 10px; border: 1px solid #ccc; border-radius: 5px; background-color: #f5f5f5; }
在這個(gè)示例中,我們創(chuàng)建了一個(gè)帶有搜索按鈕的搜索框,搜索框的寬度為300像素,居中顯示,并帶有灰色的邊框和圓角,搜索按鈕位于搜索框的右側(cè),寬度為100像素,高度為30像素,并帶有灰色的邊框和圓角,按鈕的背景顏色為#f5f5f5。
版權(quán)聲明:除非特別標(biāo)注,否則均為本站原創(chuàng)文章,轉(zhuǎn)載時(shí)請(qǐng)以鏈接形式注明文章出處。