
語言 🇹🇼 繁體中文
入門
小工具樣式
其他前端函式庫
自訂樣式指南
本指南提供 FastComments 評論小工具 (v2) 使用的完整預設 CSS 以及一些覆寫樣式的說明。
了解預設 CSS 可讓您:
- 自訂外觀:透過覆寫特定樣式來自訂外觀
- 排除樣式問題:透過查看可用的 class 與選擇器來排除樣式問題
- 建立自訂主題:建立與小工具結構相容的自訂主題
- 與 AI 助手搭配使用:以產生自訂 CSS 修改。
如何覆寫樣式
覆寫樣式依小工具而異。對於評論小工具,您必須使用 customCSS config 參數將 CSS 傳入 iframe,或在管理後台的自訂化頁面指定 CSS,該頁面會從我們的 CDN 提供 CSS。
如何自訂樣式 
如何自訂評論小工具樣式
您可以透過兩種方式自訂評論小工具的樣式:
選項 1:透過 customCSS 參數
在初始化小工具時,將自訂 CSS 以字串形式傳遞給 customCSS 參數:
window.fcConfigs = [{
target: '#fastcomments-widget',
tenantId: 'your-tenant-id',
customCSS: `
.fast-comments .comment {
background-color: #f0f0f0 !important;
border-radius: 8px !important;
}
`
}];
選項 2:透過管理後台
- 在您的管理後台前往 小工具自訂頁面
- 捲動到「進階」中的「自訂 CSS」區段
- 輸入您的自訂 CSS
- 點選「儲存」
您輸入的自訂 CSS 將套用到網站上所有的評論小工具。
提示
- 如有需要,使用
!important以覆蓋預設樣式 - 針對特定選擇器設定,以避免影響網站的其他部分
- 在不同瀏覽器中測試您的 CSS 以確保相容性
- 小工具使用標準 CSS - 不需要特殊的前處理器
評論小工具自訂 CSS 參考(v2,最新) 

近期評論小工具樣式 
The Recent Comments Widget displays a list of the most recent comments across your site or for a specific page. It includes a heading, rounded avatars, comment previews, clickable dates that deep-link to the comment, and automatic dark mode detection.
基本安裝
Run 
設定選項
- tenantId (required): 您的 FastComments 租戶 ID
- urlId (optional): 篩選到單一頁面。若要包含所有頁面請設為 null
- count (optional): 要顯示的評論數量。預設為
10 - hasDarkBackground (optional): 強制深色模式樣式。若未設定則從頁面背景自動偵測
小工具結構
The widget renders with the following HTML structure:

預設 CSS 參考

自訂範例
更改頭像大小

顯示更多行的評論文字

移除容器邊框

討論最多頁面小工具樣式 
最受討論頁面小工具會顯示您被評論次數最多的頁面排名清單。它包含標題、編號排名、帶圖示的評論數、最後活動日期,以及自動深色模式偵測。
基本安裝
Run 
設定選項
- tenantId (必填):您的 FastComments 租戶 ID
- hasDarkBackground (選填):強制使用深色樣式。若未設定,則會從頁面背景自動偵測
小工具結構
該小工具會以下列 HTML 結構呈現:

預設 CSS 參考

自訂範例
移除排名徽章

移除容器邊框

近期討論小工具樣式 
The Recent Discussions Widget displays a list of pages sorted by the most recent comment activity. It includes a heading, last activity dates, comment counts with icons, and automatic dark mode detection.
基本安裝
Run 
設定選項
- tenantId(required): Your FastComments tenant ID
- count(optional): Number of pages to show. Default is
20, max100 - hasDarkBackground(optional): Force dark mode styling. Auto-detected from the page background if not set
小工具結構
The widget renders with the following HTML structure:

預設 CSS 參考

客製化範例
移除容器邊框

自訂連結顏色
