<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebPage/CSSMediaType",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "s:6WebKit0A4PageC12CSSMediaTypeV"
  },
  "title" : "WebPage.CSSMediaType"
}
-->

# WebPage.CSSMediaType

A CSS media type as defined by the [CSS specification](https://www.w3.org/TR/mediaqueries-4/#media-types), or an arbitrary media type value.

```
struct CSSMediaType
```

## Overview

Media types are one of several media queries that influence the `@media` CSS at-rule; this rule is used
by webpages to apply parts of a style sheet depending on the media properties specified.

You can customize the media type of a [`WebPage`](/documentation/WebKit/WebPage) by using the [`mediaType`](/documentation/WebKit/WebPage/mediaType) property.

## Topics

### Initializers

[`init(rawValue: String)`](/documentation/WebKit/WebPage/CSSMediaType/init(rawValue:))

Create a media type with an arbitrary value.

### Instance Properties

[`let rawValue: String`](/documentation/WebKit/WebPage/CSSMediaType/rawValue)

The raw value of the media type.

### Type Properties

[`static let all: WebPage.CSSMediaType`](/documentation/WebKit/WebPage/CSSMediaType/all)

Corresponds to the “all” media type.

[`static let print: WebPage.CSSMediaType`](/documentation/WebKit/WebPage/CSSMediaType/print)

Corresponds to the “print” media type.

[`static let screen: WebPage.CSSMediaType`](/documentation/WebKit/WebPage/CSSMediaType/screen)

Corresponds to the “screen” media type.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Equatable`](/documentation/Swift/Equatable)

[`Sendable`](/documentation/Swift/Sendable)

---

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)