Home > Enterprise >  Why does some CSS Function not work in my WPF WebBrowser Element?
Why does some CSS Function not work in my WPF WebBrowser Element?

Time:11-24

So I have in WPF an Web Browser Element and filld it with some html Code with CSS. And The Web Browser Element show nearly everything I put in the CSS part. But the only things that dosent work in the Web Browser element, but work fine in an normal HTML file is stuff like Hover Effect and nth-child. The other CSS Stuff is working and showing correctly in the Web Browser.

here my HTML Code:

<style>
table tr{
background-color: #494D54;
color:lightblue;
font-family: Arial, Helvetica, sans-serif;
font-weight: bolder;
}
table tr:hover{
background-color: #636873;
}
table{
  border-collapse: collapse;
  width: 100%;
}

table td{
  border: 1px solid #ddd;
  padding: 8px;
}
.lb_table_subtitle{
    padding-top: 12px;
    padding-bottom: 12px;
    text-align: left;
    background-color:#114C88;
    color: white;
}

lb_table_subtitle:hover{
    background-color:#636873;
}
table tr:nth-child(odd){background-color: #2E3136;}
body {
    background-color:#494D54;
    border-radius: 50px;
}
</style>
<table cellSpacing="0"  cellPadding="0" width="100%" class="lb_table"><tr><td colspan="2" class="lb_table_subtitle">Technische Spezifikationen</td></tr><tr><td>Prozessor</td><td>Intel Xeon</td></tr><tr><td>Prozessortyp</td><td>Xeon MP</td></tr><tr><td>Anzahl der CPUs</td><td>2</td></tr><tr><td>Anzahl der CPU-Steckplätze</td><td>4</td></tr><tr><td>Prozessortakt (MHz)</td><td>1900</td></tr><tr><td>Prozessor Cache (kb)</td><td>1024</td></tr><tr><td>Front Side Bus - FSB (MHz)</td><td>400</td></tr><tr><td>Arbeitsspeicher (GB)</td><td>1</td></tr><tr><td>Festplattentyp</td><td>SCSI</td></tr><tr><td>Grafikkarte onboard</td><td>ja</td></tr><tr><td>Sound</td><td>nein</td></tr><tr><td>Anzahl der Netzteile</td><td>2</td></tr><tr><td>Bauart</td><td>Rack</td></tr><tr><td colspan="2" class="lb_table_subtitle">Festplatten - weitere HDDs oder einzelne Rahmen auf Anfrage</td></tr><tr><td>36 GB SCSI</td><td>1</td></tr><tr><td>Gesamtkapazität (GB)</td><td>36</td></tr><tr><td>max. Festplatten</td><td>3</td></tr><tr><td colspan="2" class="lb_table_subtitle">Weitere Laufwerke</td></tr><tr><td>CD-ROM</td><td>ja</td></tr><tr><td>Diskettenlaufwerk</td><td>ja</td></tr><tr><td colspan="2" class="lb_table_subtitle">PCI-Devices onboard</td></tr><tr><td>Device_1</td><td>Ethernet Pro 100</td></tr><tr><td>Device_2</td><td>SCSI-Controller U160</td></tr><tr><td colspan="2" class="lb_table_subtitle">Erweiterungssteckplätze</td></tr><tr><td>PCI 64-bit 33MHz</td><td>1</td></tr><tr><td>PCI 64-bit 66MHz</td><td>4</td></tr><tr><td>PCI-X 133MHz</td><td>1</td></tr><tr><td colspan="2" class="lb_table_subtitle">Anschlüsse</td></tr><tr><td>VGA</td><td>1</td></tr><tr><td>Ethernet RJ45</td><td>1</td></tr><tr><td>PS/2</td><td>2</td></tr><tr><td>Serial Port</td><td>1</td></tr><tr><td>USB</td><td>3</td></tr></table>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

Note!: I cant change the Html Code with the table in it. Because I got this html string from an SQL data and can only add the CSS Style.

CodePudding user response:

The WebBrowser control in WPF internally uses a native ActiveX control that is kind of dated.

If you want a modern browser experience that supports the latest HTML and CSS in your app, you should switch to using the WebView2 control.

  • Related