前段开发工作笔记
//=====================================
底图截取
background-position:-570px -410px;
//=====================================
border 宽度不算在width里面;
var temp7 = document.getElementById("anav7");
temp7.style.backgroundImage = "url(/QW2012/images/top_Bg_current.jpg)";
temp7.style.backgroundPosition = "-790px 0px";
//=====================================
!important 可被FireFox和IE7识别
* 可被IE6、IE7识别
_ 可被IE6识别
*+ 可被IE7识别
//=====================================
a标签相应javascript事件
<a href="javascript:qqlink()" class="kfqq">
//=====================================
width:expression(document.body.clientWidth < 600? "600px": "auto" );
//=====================================
6. CSS网页制作中删除链接上的虚线框
a:active, a:focus {
outline:none;
}
//=====================================
IE6尾部重复字符bug , IE6下产生多余字符的BUG
分类: css样式 Java_WEB开发 2011-08-09 09:51 154人阅读 评论(0) 收藏 举报
在web开发时发现页面中循环列表输出时在最后一条会出现几个字符复制输出,影响布局,经过网上搜索、自己试验得到几个解决办法,与大家交流
1.有可能是在两个浮动的div中间用了<!--xxx-->注释,这种情况出现这种情况
2.在重复的行尾加个 空格字符
3.再循环最后加入一个<div style="clear: both; height: 0pt; overflow: hidden;"></div>
//=====================================
ie6使用绝对定位position:absolute,box不显示
要及时清理浮动chler:both;
//=====================================
<!--[if lte IE 6]><link rel="stylesheet" type="text/css" href="***.css" /><![endif]-->
如何让HTML标签的同时加载多个样式类(HTML) //=====================================
<style>
.class1{font-weight:bold;font-size:45px;}
.class2{color:red;}
</style>
<div class="class1 class2">asdfa</div>
取消a标签虚线
//=====================================
body a{
cursor:pointer;
outline:none;
blr:expression(this.onFocus=this.blur());
}
js面向对象demo//=====================================
var game1;
var game2;
function init()
{
show.setGame();
}
function showGame(){
this.showFun = function (game){
game1.style.display = "none";
game2.style.display = "none";
game.style.display = "block";
};
this.setGame = function()
{
game1 = document.getElementById("game1_div");
game2 = document.getElementById("game2_div");
};
}
var show = new showGame();
function suShowGame()
{
showGame.call(this);
}
suShowGame.prototype = showGame.prototype;
var suShow = new suShowGame();
注:1.一定要在页面加载完成后在运行js;
2.js的工厂类型;
3.js的同过call(this,参数1,参数2,..)或apply(this,[参数1,参数2,..])实现继承方法;
大块定位不要用magin,而要用left和top定位/=====================================
同一级用left和top定位;上下级用padding定位,少用magin定位;
/=====================================
在IE6浏览器下,haslayout下的元素负margin超出父标签的部分会被隐藏掉
解决方法;将隐藏对象设置为相对定位;即设置margin负值元素的position属性值为relative;
凡人标签在margin负值下,后者会覆盖前者。单只要设置了相对定位。就可以解决。在最上面了;
/=====================================
设置透明度兼容各个浏览器
#right {
.......
filter:alpha(opacity=50);
-moz-opacity:0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
}
/=====================================
文字滚动
<html>
<head><title>文字滚动</title></head>
<body>
<marquee direction="left" behavior="scroll" scrollamount="10" bgcolor="" width="1000" height="" scrolldelay="">
你好,中国!!!
</marquee>
</body>
</html>
/=====================================
tab切换 a.active优先级别比普通意义的a要高;
ul.tabs li a {
background-color:#464c54;
color:#ffebb5;
background-position:bottom;
}
ul.tabs li a:hover {
background-color:#2f343a;
border-color:#2f343a;
}
ul.tabs li a.active {
background-color:#ffffff;
color:#282e32;
}