どのように私は新しい電子ウィンドウのCSSを使用していますか?

ニクラスKlausberger:

私は新しいBrowserWindowに次のように作成したが、私のCSSは仕事をしません。どのように私は、このウィンドウにそれを適用するのですか?

$("#btn-new-client").click(function() {
            const remote = require('electron').remote;
            const parent = remote.getCurrentWindow();
            const BrowserWindow = remote.BrowserWindow;
            const child = new BrowserWindow({
                height: 400,
                width: 800,
                parent: parent,
                modal: true
            });

            child.loadFile('new/client.html')
        });
エリック:

通常のブラウザと同じように、あなたのHTMLファイルにスタイルシートをリンクする必要があります(new/client.html)。あなたが持っていると言うnew/styles.css同じフォルダ内のファイルを。

  <!-- inside 'new/client.html' -->
<head>
  <!-- ... -->
  <link rel="stylesheet" type="text/css" href="./styles.css">
  <!-- ... -->
</head>

お使いのブラウザのウィンドウのデベロッパーツールでは、スタイルシートへのリンクが正しいことを確認してください。

おすすめ

転載: http://10.200.1.11:23101/article/api/json?id=392256&siteId=1