我在谷歌上进行了速度测试,我的CSS得分很高,成绩也很差.糟糕的成绩是由于CSS效率低下造成的.那是什么?我该如何纠正呢?
Very inefficient rules (good to fix on any page):
#menu ul ul li:first-child a:after Tag key with 4 descendant selectors
#menu ul ul li:first-child a:hover:after Tag key with 4 descendant selectors
Run Code Online (Sandbox Code Playgroud) 边框不会在下面的代码中删除,这是图像精灵.我尝试了一些方法来使用样式和边框0删除边框,但没有用.
<style>
img.home{width:40px;height:32px;
background:url(share.png) 0 0;
border-style: none;}
img.next{width:40px;
height:32px;background:url(share.png) -36px 0;
border-style:none;}
</style>
<a href="http://www.yahoo.com/">
<img class="home" border="0">
</a>
<img class="next" border="0"/>
Run Code Online (Sandbox Code Playgroud)
我使用订阅脚本将用户电子邮件地址添加到mysql记录.我使用下面的代码进行此过程.工作正常.用户提交电子邮件后页面刷新,数据库也更新为mysql :-).但问题是,当我在提交电子邮件后刷新页面时,我正在获得一个符合表格的重新提交对话框.如果我点击继续按钮,同一个电子邮件(dublicate)正在更新新记录.我的数据库正在使用相同的电子邮件地址进行更新当我刷新页面.如何禁用此消息并停止更新mysql中的相同重复记录.
<form id="myForm" action="" onsubmit="return validateForm();"method="post">
<input type="hidden" name="action" value="update" />
<input type="text" name="email" id="email" value="Enter your email here" onfocus="if (this.value == 'Enter your email here') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Enter your email here';}" onwebkitspeechchange = "this.value = this.value.replace('Enter your email here','')" style=" margin:0px 0px 0px 26px;color:#999; border:4px solid #bbb;border-radius:6px;font-size:1em;width:260px;height:30px; font-style:italic; font-family:"Times New Roman", Times, serif;"/>
<br>
<center>
<input class="button" type="image" src="rss.png" />
</center>
</form>
<?php
$email = $_POST['email'];
mysql_connect ("localhost", "root", "") or …
Run Code Online (Sandbox Code Playgroud) 我有一个CSS精灵图像,footer1.png
.我想使用CSS来裁剪图像的一部分,然后将图像平铺为我的.headimg3
元素的背景.
我正在尝试使用clip
和background
属性来实现这一点,但图像不会被裁剪.
.headimg3 {
background: url(footer1.png) bottom;
background-position: -35px -358px;
background-repeat: repeat;
height:34px;
overflow: hidden;
clip: rect(0px, 200px, 0px, 400px);
}
.headimgp {
padding: 8px 0px 0px 10px;
text-shadow: 2px 1px #fff;
}
Run Code Online (Sandbox Code Playgroud)
<div class="headimg3">
<div class="headimgp">
LATEST Updates
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
如何仅使用CSS裁剪和平铺背景图像?