• Skip to main content
  • Skip to search
  • Skip to select language
MDN Web Docs
  • References
    • Overview / Web Technology

      Web technology reference for developers

    • HTML

      Structure of content on the web

    • CSS

      Code used to describe document style

    • JavaScript

      General-purpose scripting language

    • HTTP

      Protocol for transmitting web resources

    • Web APIs

      Interfaces for building web applications

    • Web Extensions

      Developing extensions for web browsers

    • Accessibility

      Build web projects usable for all

    • Web Technology

      Web technology reference for developers

  • Learn
    • Overview / MDN Learning Area

      Learn web development

    • MDN Learning Area

      Learn web development

    • HTML

      Learn to structure web content with HTML

    • CSS

      Learn to style content using CSS

    • JavaScript

      Learn to run scripts in the browser

    • Accessibility

      Learn to make the web accessible to all

  • Plus
    • Overview

      A customized MDN experience

    • AI Help

      Get real-time assistance and support

    • Updates

      All browser compatibility updates at a glance

    • Documentation

      Learn how to use MDN Plus

    • FAQ

      Frequently asked questions about MDN Plus

  • Curriculum New
  • Blog
    • Playground

      Write, test and share your code

    • HTTP Observatory

      Scan a website for free

    • AI Help

      Get real-time assistance and support

  • Log in
  • Sign up for free
  1. 面向开发者的 Web 技术
  2. Web API
  3. CSSStyleSheet
  4. CSSStyleSheet.deleteRule()
    • English (US)
    • Deutsch
    • Español
    • 日本語

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

  1. CSS 对象模型(CSSOM)
  2. CSSStyleSheet
  3. 构造函数
    1. CSSStyleSheet()
  4. 实例属性
    1. cssRules
    2. ownerRule
    3. rules 已弃用
  5. 实例方法
    1. addRule() 已弃用
    2. deleteRule()
    3. insertRule()
    4. removeRule() 已弃用
    5. replace()
    6. replaceSync()
  6. 继承
    1. StyleSheet
  7. CSSOM 的相关页面
    1. CSS
    2. CSSConditionRule
    3. CSSFontFeatureValuesRule
    4. CSSFontPaletteValuesRule
    5. CSSGroupingRule
    6. CSSImportRule
    7. CSSKeyframeRule
    8. CSSKeyframesRule
    9. CSSLayerBlockRule
    10. CSSLayerStatementRule
    11. CSSMediaRule
    12. CSSNamespaceRule
    13. CSSPageDescriptors 实验性
    14. CSSPageRule
    15. CSSPropertyRule
    16. CSSRule
    17. CSSRuleList
    18. CSSStartingStyleRule
    19. CSSStyleDeclaration
    20. CSSStyleRule
    21. CSSSupportsRule
    22. CaretPosition
    23. MediaList
    24. MediaQueryList
    25. Screen
    26. StyleSheet
    27. StyleSheetList

CSSStyleSheet.deleteRule()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

  • Learn more
  • See full compatibility
  • Report feedback

概述

deleteRule方法用来从当前样式表对象中删除指定的样式规则。

语法

stylesheet.deleteRule(index)

参数

  • index 是一个数字,用来指定样式规则的位置.

示例

 myStyles.deleteRule(0);

参见

  • insertRule

规范

deleteRule

Help improve MDN

Learn how to contribute.

This page was last modified on 2024年12月13日 by MDN contributors.

View this page on GitHub • Report a problem with this content
MDN logo

Your blueprint for a better internet.

  • MDN on Bluesky
  • MDN on Mastodon
  • MDN on X (formerly Twitter)
  • MDN on GitHub
  • MDN Blog RSS Feed

MDN

  • About
  • Blog
  • Careers
  • Advertise with us

Support

  • Product help
  • Report an issue

Our communities

  • MDN Community
  • MDN Forum
  • MDN Chat

Developers

  • Web Technologies
  • Learn Web Development
  • MDN Plus
  • Hacks Blog
  • Website Privacy Notice
  • Cookies
  • Legal
  • Community Participation Guidelines

Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2025 by individual mozilla.org contributors. Content available under a Creative Commons license.