
語言 🇹🇼 繁體中文
入門指南
小工具樣式
其他前端函式庫
自訂樣式指南
本指南提供 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 - 不需要特殊的前處理器
自訂評論框邊框 
The border around the comment box is made of the text area's own border plus a few thin lines the widget draws around it. To change its color or corner roundness, set these CSS variables instead of styling the textarea directly. The variables restyle every part of the border at once, so the corners and colors always line up.
| 變數 | 變更內容 | 預設 |
|---|---|---|
--fc-input-border-color | 邊框顏色 | #bfbfbf |
--fc-input-border-color-focus | 使用者輸入時的邊框顏色 | #555 |
--fc-input-border-radius | 圓角的圓潤程度 | 11px |
--fc-input-border-start-start-radius | 左上角(在從右至左語言中為右上角)方形角的圓潤程度 | 0 |
Add the CSS to the Custom CSS box on the Widget Customization page, or pass it with the customCSS option. You only need to set the variables you want to change.
You can also use the Comment box border helper right under the Custom CSS box, which writes this CSS for you.
變更邊框顏色

輸入時變更邊框顏色

圓化所有四個角
By default the top-left corner is square. Set both radius variables to round all four corners the same:

方形角

與您的品牌相符

暗色模式下的不同顏色
When the widget is in dark mode it has the dark class, so you can set different values for dark mode:

為何不直接為文字區域設定樣式?
The widget draws part of the comment box border itself, around the text area. If you set border-color or border-radius only on the textarea, those lines keep the default style and the border looks mismatched, for example a square line running through a rounded corner. The variables above change both at once.
評論小工具自訂 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 參考

客製化範例
移除容器邊框

自訂連結顏色
