iOS – CSS in WKWebView in swift


We can use CSS in our WKWebView to handle the layouts according to our usage.

Please find an example for using the CSS in WKWebView in swift :-

The above two lines helps to set the size of the images inside the WKWebView. We can use any of the CSS according to our use.

Drag and drop a WKWebView in view controller

Call the delegate in class

There is one delegate method that helps in showing the data accurately according to the CSS applied to it. Use the below delegate func for applying the CSS in webview :

The whole code given below that will help you to connect all the functionality :

Hope the above blog will help you in understanding the use of CSS in WKWebView in swift.

. . .

Leave a comment


We've bought a Shopware Extension which is a hybrid App, which we can now offer in the Google Play Store and the IOS App Store. I'am still impressed how fast and how sharp the support team leads us through every process of the App-Store clarification. Very fast and useful response.

Markus Walter

Markus Walter

Founder, Das Apartment Living

Talk to Sales


Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home