主题:
3024-night
ambiance-mobile
ambiance
base16-dark
blackboard
cobalt
eclipse
erlang-dark
lesser-dark
mbo
mdn-like
midnight
monokai
neat
neo
night
paraiso-dark
pastel-on-dark
rubyblue
solarized
the-matrix
tomorrow-night-eighties
vibrant-ink
新窗口
视图:
左侧面板
HTML
CSS
JS
预览
F11(全屏显示选中的编辑器)
查看更多帮助信息
相关文章:
jQuery.css() 函数详解
代码类型:
默认(HTML/CSS/JS)
HTML混合(单页)
PHP
Java
C#
C++
C
SQL
杂项:
启用CSS/JS语法检查
监测脚本运行错误
禁止库文件重复
文档类型:
HTML5
HTML 4.01 Strict
HTML 4.01 Transitional
HTML 4.01 Frameset
XHTML 1.0 Strict
XHTML 1.0 Transitional
XHTML 1.0 Frameset
无
JS库文件:
无
jQuery 1.11.1
jQuery 2.1.1
jQuery 1.10.2
jQuery 1.9.1
jQuery 1.8.3
jQuery 1.7.2
jQuery 1.6.4
jQuery 1.5.2
jQuery 1.4.4
jQuery 1.3.2
jQuery 1.2.6
手动添加:
jQuery 1.11.1
<p id="n1" style="font-size: 16px; font-weight:bold; color: #333; margin: 10px 5px;">CodePlayer</p> <p id="n2" style="font-size: 14px; font-weight:bold; color: #aacd12; padding: 5px ; border: 1px solid #000;">专注于编程开发技术分享</p>
//在当前页面内追加换行标签和指定的HTML内容 function w( html ){ $(document.body).append("<br/>" + html); } var $n1 = $("#n1"); var $n2 = $("#n2"); w( $n1.css("fontSize" /* 或者"font-size" */ ) ); w( $n1.css("margin") ); // Chrome:10px 5px | FireFox和IE下无输出 w( $n1.css("marginTop") ); // 10px (所有浏览器均支持) w( $n1.css("marginLeft") ); // 5px (所有浏览器均支持) // 取消n1的粗体 $n1.css("fontWeight", "normal"); // 更改n2的背景色和字体 $n2.css( { backgroundColor: "#efefef", "font-family": '"Microsoft Yahei"' } ); var styleObj = $n2.css( ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"] ); w( styleObj.paddingTop ); // 5px w( styleObj.paddingRight ); // 5px // 删除n2的border属性 $n2.css("border", ""); // 更改所有p元素的font-weight属性 // 如果是粗体就还原,不是粗体就加粗 $("p").css("fontWeight", function(index, value){ return value == "bold" || value == "700" ? "normal" : "bold"; });