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