Skip to content
masterclass Buddy

Cypress · Matcher

have.css

have.css checks a DOM element's CSS property, with an optional expected value. Cypress retries the assertion until the value matches or the command times out.

Last updated

Syntax

.should('have.css', property, value)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • should
  • and
  • not.have.css
  • cy.get
  • cy.contains
  • Visibility

Source: Assertions in Cypress | Cypress Documentation. Checked 2026-11-03.