我想改變我的ng2-pdf瀏覽器中滾動條的樣式...檢查完元素后,帶有滾動條的元素有一個類. ng2-pdf-viewer-container
這是我的代碼...css對滾動條沒有影響。
我錯過了什么?
::ng-deep .ng2-pdf-viewer-container {
-webkit-overflow-scrolling: touch;
}
::ng-deep .ng2-pdf-viewer-container ::-webkit-scrollbar {
width: 12px;
}
::ng-deep .ng2-pdf-viewer-container ::-webkit-scrollbar-track {
background-color: #0dbdaf;
}
::ng-deep .ng2-pdf-viewer-container ::-webkit-scrollbar-thumb {
background-color: #932222;
border-radius: 6px;
}
<div class="contractWrap">
<pdf-viewer
src="{{selectedApproval.contractLink}}"
[original-size]="false"
[pageFit]="true"
[zoom]="0.95"
class="pdfer"
[autoresize]="false"
></pdf-viewer>
</div>
下面是編輯滾動條的方法...
.ng2-pdf-viewer-container::-webkit-scrollbar {
width: 10px; /* Set the width of the scrollbar */
}
.ng2-pdf-viewer-container::-webkit-scrollbar-track {
background-color: #f1f1f1; /* Set the background color of the track */
}
.ng2-pdf-viewer-container::-webkit-scrollbar-thumb {
background-color: #132FBD; /* Set the background color of the thumb */
border-radius: 5px; /* Set the border radius of the thumb */
}
.ng2-pdf-viewer-container::-webkit-scrollbar-track,
.ng2-pdf-viewer-container::-webkit-scrollbar-thumb {
/* Set the width of the track */
border: 3px solid transparent; /* Use a transparent border to simulate the track width */
background-clip: content-box; /* Ensure the background color only covers the content box */
}