<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style> *{ margin:0px; padding:0px;} .serch_left{ border-radius:20px;} .serch ,.serch_left,.serch_right{ height:40px; } .serch { width:500px; border:#000 0px solid; background:#09F; margin:50px; border-radius:20px;} .serch_left { width:390px; height:36px; border:#09F 2px solid; background:#FFF;} .serch_right{ width:90px;} .serch_left,.serch_right{ float:left; text-align:center;} .serch_right{height:30px; padding-top:10px; color:#FFF; font-weight:bold; cursor:pointer;} .inp_serch{ width:390px; padding-left:30px; background:url(img/serch.png) no-repeat 5px 5px; height:35px; border:0px; border-radius:20px; border-color:#FFF; font-size:20px;} </style>
<script src="js/jquery-1.8.3.min.js"></script> <script > $(function(){ $(".inp_serch").css("color","#CCC").focus(function(){ /*val() 能取得值 还可以 赋值*/ if($(this).val()==""){ $(this).val("搜索"); } }).blur(function(){ if($(this).val()=="搜索"){ $(this).css("color","#CCC"); }else{ $(this).css("color","black"); } }); $(".serch_right").click(function(){ alert($(".inp_serch").val()); }); }); </script>
<style> .yuan{ width:20px; height:20px; border-radius:20px; background-color:#F00; color:#FFF; font-weight:bold; text-align:center; margin:5px; float:10px;}
.cl{ width:200px; height:40px; border-top-left-radius:10px; border-bottom-right-radius:10px; border:#00F 2px solid;} </style>
</head>
<body>
<div class="yuan">1</div> <div class="yuan">2</div> <div class="yuan">3</div> <div class="yuan">4</div> <div class="cl"></div> <div class="serch"> <div class="serch_left"> <input type="text" class="inp_serch"/> </div> <div class="serch_right">搜索</div> </div>
</body> </html>
使用css3制作导航及画圆及椭圆边框的实现,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/huanghaixiong/p/3750748.html