【问题标题】:css background image delay on loadcss背景图片加载延迟
【发布时间】:2013-12-05 11:22:50
【问题描述】:

我有这样的表格:

 <form  action="login_form.php"   method="POST"   id="login_form">         
   Email  <input name="email" type="text" size="25" placeholder="type your email"/>
   Password  <input name="password" type="text" size="25" placeholder="type your password" />
             <input type="submit" class="btn" value="" name="submit" />
 </form>

对于提交按钮,我使用 CSS 中的图片:

.btnew{
background:url('img/login_button_1_1.jpg') no-repeat; width:270px; height:46px; border:none; cursor: pointer; 
}

.btnew:hover{
background:url('img/login_button_1_1_light.jpg') no-repeat; width:270px; height:46px; border:none; cursor: pointer;
}

当页面加载我的表单时,“login_button_1_1.jpg”作为提交按钮。当用户将鼠标放在提交按钮上时,根据我的 CSS,按钮成功更改为“login_button_1_1_light.jpg”。我的问题是,用户第一次将鼠标放在提交按钮上时,在图像“login_button_1_1_light.jpg”出现之前会有一个非常小的延迟。看起来它在开始时没有加载页面。知道如何解决这个问题吗?

【问题讨论】:

标签: html css


【解决方案1】:

您可以将悬停图像放在body 标签内进行预加载。

<img src="img/login_button_1_1_light.jpg" style="display:none;" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-08-14
    • 2014-06-05
    • 1970-01-01
    • 2018-08-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多