开发者

White space in top of div

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<style type="text/css">
#myDialog{
  width:19%;
  height:170px;
  -moz-border-radius: 10px;
  -webkit-border-radius: 10px;
   border-radius: 10px;

}
#hqalert{
   width:100%;
   height:30px;
   background: -moz-linear-gradient(top, rgba(99,182,219,1) 29%, rgba(48,157,207,1) 52%);
   -moz-border-radius: 10px;
   -webkit-border-radius: 10px;
   border-radius: 10px;
}
</style>
<script type='text/javascript'>
function myinf(that)
{
if(that.value>15){
document.getElementById("myDialog").style.borderColor="#6EB6D5";
document.getElementById("myDialog").style.borderWidth="0.1px";
document.getElementById("myDialog").style.borderStyle="solid";
document.getElementById("myDialog").style.display='block';
}
}
</script>
</head>
<body>

      <input type="text" onblur="myinf(this)"  value="12" id="smps"/>
      <input type="button" id="one"/>
      <div id="myDialog" style="display:none;" ><p id="hq开发者_Python百科alert">General Alert:</p></div>
  </body>
</html>

When running the above html, it shows an alert. If we enter a value greater than 15 inside the text box it works fine, but the alert has white space at the top. How can I remove it?


Add margin-top:0px; to your #hqalert style.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜