网页设计中HTML代码、CSS代码和javascript的技巧和细节

2020-04-28 08:04:16易采站长站整理

从上到下
style="filter:progid:DXImageTransform.microsoft.gradient(gradienttype=0,startColorStr=blue,endColorStr=white);"
3.a hover的样式实现多种效果,可以灵活运用
#outer a { border:1px solid #069;}
#outer a:hover {border:1px dashed #c00;}
4.border:none;与border:0区别
理论上的性能差异:
border:0;把border设为“0”像素虽然在页面上看不见,但按border默认值理解,浏览器依然对border-width/border-color进行了渲染,即已经占用了内存值。border:none;把border设为“none”即没有,浏览器解析“none”时将不作出渲染动作,即不会消耗内存值。
兼容性差异:
兼容性差异只针对浏览器IE6、IE7与标签button、input而言,在win、win7、vista 的XP主题下均会出现此情况。当border为“none”时似乎对IE6/7无效边框依然存在,当border为“0”时,感觉比“none”更有效,所有浏览器都一致把边框隐藏,
如何让border:none;实现全兼容?只需要在同一选择符上添加背景属性即可
5.css实现多列等高布局,正内边距与负外边距
给每个需要实现等高的列应用样式:.e{padding-bottom:32767px;margin-bottom:-32767px;}
6.position:relative;特殊用法????


* {margin:0;padding:0;font:normal 12px/25px “宋体”;}
body {background:#f8f8f8;}
ul {list-style:none;width:300px;height:25px;margin:20px auto;}
li {float:left;width:86px;height:25px;text-align:center;margin:0 -5px;display:inline;}
a {color:#fff; float:left;width:86px;height:25px;top:0;left:0;background:url(***.gif) center center no-repeat;}
a:hover {color:#000;background:url(***.gif) 0 0 no-repeat;width:86px;position:relative;}

细节6………………………………………………………………………………
1。innerText:从起始位置到结束位置的内容,不包含标签 innerHTML


outerHTML:包含 innerHTML和标签
<div id=”test”><span>test1</span>test2</div>
test.innerText:test1 test2
test.innerHTML:<span>test1</span>test2
test.outerHTML:<div id=”test”><span>test1</span>test2</div>

2。Number():任何包含非数字字符的字符串做参数时,结果为NaN
parseInt():从左到右尽可能多低把字符串转化为数字,直到遇到一个非数字时停止
isNaN():参数不是一个数字时,返回true;
3。a=23.50abc


typeof(a)=String
parseFloat(a)=23.5
parseInt(a)=23
Number(a)=NaN

4。JS变量名包含数字字母美元符下划线,不能以数字开头