WebView and inner CSS


#1

Hello,

I’m using a WebView with src set to a string in html format, inside it I use some CSS classes which I’d like to link to a .css file in my app. Doesn’t seem to work :confused:

inside main.component.html :

<WebView src="Hello <em class='location'> World </em>"></WebView>

inside main.component.css :

.location {
background-color: #d9d5c3;
}

Is that possible ?


#2

Anything inside WebView is completely a different context, you can’t or should not do that. Either create a HTML file and write your CSS inside set same as source to WebView or keep CSS as part of your HTML string.