Note: Advice in this article will only work for DotNetBrowser 1.
See the corresponding article for DotNetBrowser 2 here.

Since DotNetBrowser 1.9 it is possible to specify custom CSS rules, which will be then applied to every page loaded in the Browser instance.

You can configure custom CSS by setting the Browser.CustomStylesheet property. The CSS rules will be applied to the next page loaded in the Browser.

To reset the custom CSS to defaults, you can set the Browser.CustomStylesheet property to an empty string.


The following sample code demonstrates how to remove scrollbars for the HTML and BODY elements:


string hideOverflowCss = "HTML, BODY {overflow:hidden;}";
browser.CustomStylesheet = hideOverflowCss;


Dim hideOverflowCss As String = "HTML, BODY {overflow:hidden;}"
browser.CustomStylesheet = hideOverflowCss

Note: the CSS rules specified by the particular page will not be overriden.