Reputation: 1110
I am working on a Xamarin.Forms PCL project with a WebView and am trying to attach custom css.
I tried putting my .css file for Android in the Assests folder and iOS in Resources folder both called default.css
My HTML is
<html><head><link rel=\"stylesheet\" href=\"default.css\"></head><p></p>
It works on Android and uses the css. The problem is with iOS it doesn't use the css file. I am also using Xamarin Live Player for iOS debugging but I would think it supports css files.
Upvotes: 2
Views: 1887
Reputation: 797
I think you need to check this project on the official documentation of Xamarin forms.
It has an HTML with styles css file in the resources. Notice the default.css
htmlSource.Html = @"<html>
<head>
<link rel=""stylesheet"" href=""default.css"">
</head>
<body>
<h1>Xamarin.Forms</h1>
<p>The CSS and image are loaded from local files!</p>
<img src='XamarinLogo.png'/>
<p><a href=""local.html"">next page</a></p>
</body>
</html>";
Here is the sample and in it there is a link to the original documentation with full description. Working with WebView
If that doesn't help, you will need to show us the steps you have done.
Upvotes: 1