易截截图软件、单文件、免安装、纯绿色、仅160KB

jQuery使用手册之CSS操作

Jquery对css的操作相当方便,能很方便我们去通过js修改css。传统javascript对css的操作相当繁琐,比如
<div id="a" style="background:blue">css</div>
取它的background语法是:
document.getElementById("a").style.background
而jQuery对css更方便的操作:
$("#a").background();$("#a").background(“red”)
说明如下
$("#a")得到jQuery对象[ <div id="a" … /div> ]
$("#a").background()将取出该对象的background样式。
$("#a").background(“red”)将该对象的background样式设为redjQuery提供了以下方法,来操作css:
background ()
background (val)
color()
color(val)
css(name)
css(prop)
css(key, value)
float()
float(val)
height()
height(val)
width()
width(val)  
left()
left(val)
overflow()
overflow(val)
position()
position(val)
top()
top(val)
这里需要讲解一下css(name);css(prop);css(key, value),其他的看名字都知道什么作用了!
<div id="a" style="background:blue; color:red">css</div><P id="b">test</P>
css(name):获取样式名为name的样式
$("#a").css("color"):将得到样式中color值red,("#a").css("background ")将得到blue
css(prop):prop是一个hash对象,用于设置大量的css样式
$("#b").css({ color: "red", background: "blue" });
最终效果是
<p id="b" style="background:blue; color:red">test</p>
{ color: "red", background: "blue" },hash对象,color为key,"red"为value,
css(key, value)  用于设置一个单独得css样式
$("#b").css("color","red");
最终效果是
<p id="b" style="color:red">test</p>


相关文档:

CSS控制DIV水平垂直方向剧中

  <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
body{position:relative; border:solid 1px #30F; height:600px; }
.box{ position:ab ......

CSS控制左边固定,右边自由伸展

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
.main{position:relative;width:100%}
.left{position:absolute;width:200px;border:solid 1px red; height: ......

【CSS】CSS 设计技巧(转)

一.使用css缩写
引用内容:
使用缩写可以帮助减少你CSS文件的大小,更加容易阅读。css缩写的主要规则如下:
颜色
16进制的色彩值,如果每两位的值相同,可以缩写一半,例如:
#000000可以缩写为#000;#336699可以缩写为#369;
盒尺寸
通常有下面四种书写方法:
property:value1; 表示所有边都是一个值value1;
proper ......

CSS之IE6,IE7,FF兼容 SF,OP兼容





DIV
CSS设计时IE6、IE7、FF 与兼容性有关的特性2008-03-28
14:21在网站设计的时候,应该注意css样式兼容不同浏览器问题,特别是对完全使用DIV CSS设计的网,就应该更注意IE6 IE7
FF对CSS样式的兼容,不然,你的网乱可能出去不想出现的效果!
所有浏览器 通用 ......

CSS解决DIV垂直居中的问题

在说到这个问题的时候,也许有人会问CSS中不是有vertical-align属性来设置垂直居中的吗?即使是某些浏览器不支持我只需做少许的CSS Hack技术就可以啊!所以在这里我还要啰嗦两句,CSS中的确是有vertical-align属性,但是它只对(X)HTML元素中拥有valign特性的元素才生效,例如表格元素中的<td>、<th>、<caption> ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号