关于CSS细节集合(一)

一、当文字与图片在一行,需要将文字与图片底对齐,需要这样写:

1
< li >记住密码< img  src = ""  align = "bottom"  style = "margin-bottom:-4px" /></ li >

二、当文字与图片在一行,需要将文字与图片居中对齐,需要这样写:

1
< li >记住密码< img  src = "static/img/xyx.jpg"  align = "middle" /></ li >

三、更改IE“查看源代码”菜单打开的编辑器

  1. 打开注册表编辑器,在开始-运行中输入regedit前端UI分享
  2. 找到以下位置: HKEY_LOCAL_MACHINE”SOFTWARE”Microsoft”Internet Explorer”View SourceEditor”Editor Name”修改默认的数据为”D:”Program Files”EmEditor”EmEditor.exe”

切换到IE中查看源代码就可以看到效果了。
如果View Source Editor”Editor Name项没有,可以自己新建。

四、自动最大化窗口,在 <body> 与 </body> 之间加入:

1
2
3
4
<SCRIPT language= "javascript" >
setTimeout( 'top.moveTo(0,0)' ,5000);
setTimeout( 'top.resizeTo(screen.availWidth,screen.availHeight)' ,5000);
</script>

五、window.opener 实际上就是用window.open打开的窗体的父窗体。

比如在父窗体parentForm里面 通过 window.open(“subForm.html”),那么在subform.html中 window.opener
就代表parentForm,可以通过这种方式设置父窗体的值或者调用js方法。

  1. window.opener.test(); —调用父窗体中的test()方法;
  2. 如果window.opener存在,设置parentForm中stockBox的值。 前端UI分享
1
2
3
4
if  (window.opener && !window.opener.closed)
     {
        window.opener.document.parentForm.stockBox.value = symbol;
     }

六、刷新页面的方法

Javascript刷新页面的方法:

  1. history.go(0)
  2. location.reload()
  3. location=location
  4. location.assign(location)
  5. document.execCommand(‘Refresh’)
  6. window.navigate(location)
  7. location.replace(location)
  8. document.URL=location.href

自动刷新页面的方法:

  1. 页面自动刷新:把<meta http-equiv=”refresh” content=”20″>加入<head>区域中
  2. 页面自动跳转:把<meta http-equiv=”refresh” content=”20;url=http://www.wyxg.com”>加入<head>区域中 前端UI分享
  3. js自动刷新页面:
1
2
3
4
5
6
7
<script language= "JavaScript" >
function  myrefresh()
{
        window.location.reload();
}
setTimeout( 'myrefresh()' ,1000);  //指定1秒刷新一次
</script>

JS刷新框架

a)刷新包含该框架的页面用

1
2
3
<script language=JavaScript>
    parent.location.reload();
</script>

b)子窗口刷新父窗口

1
2
3
<script language=JavaScript>
     self.opener.location.reload();
</script>

1
< a  href = "javascript:opener.location.reload()" >刷新</ a >

c)刷新另一个框架的页面

1
2
3
< script  language = JavaScript >
    parent.另一FrameID.location.reload();
</ script >

七、用过CSS hack应该知道,用下划线命名是一种hack,如使用“_style”这样的命名,可以让IE外的大部分浏览器忽略这个样式的定义,所以使用“_”做为命名时的分隔符是不规范的。在做CSS检查时会出现错误提示。前端UI分享

八、IE条件注释写法

<!–[if !IE]>除IE外都可识别<![endif]–>
<!–[if IE]> 所有的IE可识别 <![endif]–>
<!–[if IE 5.0]> 只有IE5.0可以识别 <![endif]–>

九、CSS HACK 写法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*第一种:*/
.div {
background :orange;
* background : green  !important ;
* background : blue ;
}
/*第二种:*/
.div {
margin : 10px ;
* margin : 15px ;
_margin : 15px ;
}
/*第三种:*/
#div {  color #333 ; }
*+html #div {  color #999 ; }
* html #div {  color #666 ; }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值