因此,我正在尝试为Electron应用程序创建全页高度的简单栏。效果不佳:通过追溯简单栏退出现有位置的位置,我已经看到简单栏仅适用于标记内样式:
此代码可以正常工作。如您所见,我已经复制了样式,因此它也位于样式标签中(最初是在CSS中,但这更易于演示)。
尝试运行它,并查看simplebar正常工作。 然后删除标签内样式,以便它必须完全依赖标签来进行相同的样式设置-消失了?
这是一些HTML专家方面的知识,我无法解决。有人知道这是怎么回事吗?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test</title>
<style>
.appContainer{text-align: center; position: fixed; background-color: grey; width: 50%; height:100%; bottom: 0; right: 25%}
.appWrapper{position: relative; display: inline-block; background-color: green; width: 400px;height:2000px;}
</style>
<link rel="stylesheet" href="https://unpkg.com/simplebar@latest/dist/simplebar.min.css">
</head>
<body>
<body>
<div data-simplebar class="appContainer" style="text-align: center; position: fixed; background-color: grey; width: 50%; height:100%; bottom: 0; right: 25%">
<div class="appWrapper" style="position: relative; display: inline-block; background-color: green; width: 400px;height:2000px;">
<h1>My First Heading</h1>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
<p>My first paragraph.</p>
</div>
</div>
</body>
<script src="https://unpkg.com/simplebar@latest/dist/simplebar.js"></script>
</body>
</html>