首页  >  选择器  > :header 源码下载

返回值:Array<Element(s)>:header

V1.2概述

匹配如 h1, h2, h3之类的标题元素

示例

描述:

给页面内所有标题加上背景色

HTML 代码:
<h1>Header 1</h1>
<p>Contents 1</p>
<h2>Header 2</h2>
<p>Contents 2</p>
jQuery 代码:
$(":header").css("background", "#EEE");
结果:
[ <h1 style="background:#EEE;">Header 1</h1>, <h2 style="background:#EEE;">Header 2</h2> ]
阿里云专属限量优惠券,限时领取~