Reputation: 120
The syntax & values to my knowledge are alright. See below.
* {
overflow: hidden;
background-color: rgba(30, 30, 30, .9);
color: rgb(242, 238, 229);
font-size: 18px;
font-family: Segoe UI,...;
}
background-color
is the only property that seems to remain neglected. !important
had no influence.
Here's the boilerplate HTML:
<!DOCTYPE html>
<html>
<head>
<link rel='stylesheet' type='text/css' href='data:text/css;charset=UTF-8,{0}'>
</head>
<body>
{1}
</body>
</html>
(If you're wondering what the {0,1}
's are, I'm formatting this in a C# WPF app, then navigating the HTML code towards an embedded WebBrowser)
The 0 corresponds to URI encoded CSS, which works as intended.
For reference, here's my code within my WPF application:
TextRange rng = new TextRange(
TextEntry.Document.ContentStart,
TextEntry.Document.ContentEnd);
string cssString = ":not(h1,h2,h3,h4,h5,h6) { font-size: 11px; } * { overflow: hidden; background-color: rgba(30, 30, 30, .9); color: rgb(242, 238, 229); font-family: Segoe UI...; }";
string htContent = string.Format("<!DOCTYPE html><html><head><link rel='stylesheet' type='text/css'"
+ "href='data:text/css;charset=UTF-8,{0}'></head><body>{1}</body></html>",
Uri.EscapeUriString(cssString),
Markdig.Markdown.ToHtml(rng.Text));
No matter how specific I get with the background-color
property, it will remain unresponsive sadly.
This is the xaml of the WebBrowser, if it helps.
<WebBrowser x:Name="Markdown" HorizontalAlignment="Left" Height="406" Margin="16,36,-9,0" VerticalAlignment="Top" Width="800" Grid.RowSpan="2"/>
All other posts I could find about this were because of an element somewhat overriding the style, though, due to how boilerplate this HTML & CSS is, I couldn't find anything of that nature.
Upvotes: 0
Views: 140
Reputation: 66
Try newest browser control (WebView2) instead, it might work
Upvotes: 1