
2.2 CSS代码 input[type="text"] { width: 200px; padding: 5px; border: 1px solid #ccc; border-radius: 5px; } select { padding: 5px; border: 1px solid #ccc; border-radius: 5px; } button[type="submit"] { background-color: #007bff; color: #fff; padding: 5px 10px; border: none; border-radius: 5px; cursor: pointer; } 2.3 JS代码 无 三、带自动补全的搜索框代码 3.1 HTML代码
3.2 CSS代码 input[type="text"] { width: 200px; padding: 5px; border: 1px solid #ccc; border-radius: 5px; } .autocomplete { position: absolute; z-index: 1; width: 200px; max-height: 200px; overflow-y: auto; background-color: #fff; border: 1px solid #ccc; border-radius: 5px; } .autocomplete li { padding: 5px; cursor: pointer; } .autocomplete li:hover { background-color: #007bff; color: #fff; } 3.3 JS代码 $(function() { var availableTags = [ "新闻", "技术", "娱乐" ]; $("input[name='q']").autocomplete({ source: availableTags }); }); 以上就是迅睿CMS搜索框代码大全,希望能对大家有所帮助。在使用时,可以根据实际需求进行修改和扩展,使搜索框更符合自己网站的特点和风格。