0

I tried to host an html file in an WinForms WebBrowser control but I could not see the header color being updated. Please refer the below image. If I opened in an Internet Explorer, the color is showing fine but it is not updating while hosting in the WebBrowser control

Below is the code I am using for style sheet. The code with background: linear-gradient(to bottom, #dfecff 0%, #b4d5ff 100%); is not been updated in WebBrowser control. Why this is happeneing? and is it possible to fix this issue?

body {
background-color: #777777;
font-family: Verdana, Geneva, sans-serif;
font-size: 9pt;
}

table { 
font-family: Verdana, Geneva, sans-serif;
font-size: 9pt;
background-color: #FFF;
}

h1, h2 {        
background: #b4d5ff;
background: linear-gradient(to bottom, #dfecff 0%, #b4d5ff 100%);
}

Below is the html code that I have used for testing.

<html><body><head>
<link rel="stylesheet" href="test.css" type="text/css" /></head>
<h2>Testing</h2>
<table>
<tr><td>text1</td></tr>
<tr><td>text2</td></tr>
<tr><td>text3</td></tr>
<tr><td>text4</td></tr>
</table>
</body>
</html>
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • Your code will work with Internet Explorer and you don't need to use a different browser control. You just need to make `WebBrowser` control to use the latest IE version installed in your system without compatibility mode. Take a look at [this post](http://stackoverflow.com/a/38514446/3110834). – Reza Aghaei Nov 30 '16 at 12:46
  • [http://stackoverflow.com/questions/790542/replacing-net-webbrowser-control-with-a-better-browser-like-chrome](http://stackoverflow.com/questions/790542/replacing-net-webbrowser-control-with-a-better-browser-like-chrome) – BALA s Nov 30 '16 at 14:26

1 Answers1

0

The WebBrowser control is based on an old version of Internet Explorer that does not support linear-gradient.

You either need to use a fallback approach that works in IE, or switch to a different control that is based on a different HTML rendering engine with wider-ranging support for modern CSS.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574