<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebView-swift.class/styleDeclaration(withText:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WebView(im)styleDeclarationWithText:"
  },
  "title" : "styleDeclaration(withText:)"
}
-->

# styleDeclaration(withText:)

Returns the CSS style declaration for the specified text.

```
func styleDeclaration(withText text: String!) -> DOMCSSStyleDeclaration!
```

## Parameters

`text`

The text whose style declaration is returned.

## Return Value

The style declaration for `text`.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)