基本的なスタイルの チュートリアル

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

このページでは Confluence でカスタム CSS スタイルを使用する方法について説明します。

CSS 編集のクイックスタート

スペースのCSSスタイルシートを編集するには:
  1. スペースに移動して、サイドバーの下部から、スペース ツール > ルックアンドフィールを選択します。
  2. スタイルシートを選択し、その後編集 を選択します。
  3. カスタムCSSを、テ​​キストフ​​ィールドに貼り付けます。
  4. 変更を保存します。新しいCSSは、スペース内のすべてのコンテンツページに表示されます。

スペースでドキュメント用テーマを使用している場合:

  1. ヘッダーから 参照 > スペース管理者 を選択します。

    注意: スペース管理オプションは、スペース管理権限を持っているか、 "confluence-administrators" グループに属している場合にのみ表示されます。

  2. 「ルックアンドフィール」という見出しの左パネルで、スタイルシートをクリックします。
  3. 編集 を選択します 。
  4. カスタムCSSを、テ​​キストフ​​ィールドに貼り付けます。
  5. 変更を保存します。新しいCSSは、スペース内のすべてのコンテンツページに表示されます。

チュートリアル: ヘッダーの背景色の変更

ヘッダーとは、既定の Confluence ページの最上部にあるメニュー領域を指し、Breadcrumb リンク参照メニュー、ユーザーメニューおよびクイック検索ボックスがあります。次の例では、カスタムグラフィックを組み込むためにヘッダーの背景色を変更します。

  1. カスタムグラフィックを作成します。この例では、 1046 x 61 ピクセルのカスタムヘッダーグラフィックを作成しました。
  2. Upload the custom graphic to a page in the space that you are customising.
  3. 新しいグラフィックをアップロードしたページのページ ID をメモします。(この例では、ページ ID は '658833839' です。
  4. ヘッダー用のカスタム CSS を作成します。以下の例では、新しいグラフィック ('header.png') を同じスペースの特定のページ (ページ ID '658833839' で表示) からロードします。

     #header .aui-header  {
           background-image:url('../download/attachments/658833839/header.png');
           background-repeat: no-repeat;
        }
    
  5. スペース管理者としてログインします。
  6. スペース管理ページを開きます。
  7. スタイルシートをクリックします。
  8. 編集をクリックしてテキストフィールドのコードを変更します。
  9. カスタムCSSを、テ​​キストフ​​ィールドに貼り付けます。
  10. 保存をクリックしてからページを再読み込みします (Shift + 再読み込みキーを押す必要がある場合もあります)。ヘッダーの背景色が変更されます。
  11. カスタムヘッダーは、スペース内のすべてのコンテンツページで表示されます。変更を戻すには、単に 'Stylesheet' ページからカスタムコードを削除して、保存をクリックします。

CSS 編集のヒント

スペーススタイルシートから着手する

A space stylesheet is a good starting point for CSS customisation, as it already includes all of the elements that can be changed. When you work on the space stylesheet it styles all content pages in the space. Build and test it at space-level, before considering applying the new stylesheet to your entire site. Once you are satisfied with your space design, test it thoroughly until you are confident that it has no problems. Then, you can look into advanced customisation of the Confluence CSS such as adjusting the Search page, the Dashboard and other integral pages.

適切なツールを使用する

Confluence CSS はかなり洗練されているため、 Web 開発アプリケーションを通じて、ユーザーはページのスタイルがどのように作成されたかを理解することになります。特に、作業を開始するページの既存のソースを表示する必要があります。これを実行するためのツールをまだ持っていない場合、次のフリーアプリケーションなどのツールが役立ちます。

1. Firebug
Firebug は、Firefox Web ブラウザーのプラグインで、ページの各要素のスタイルを調べることができます。現在適用されているスタイル (ヘッダーのみに適用されているスタイルなど) を知るには非常に役立ちます。

2. Web Developer
Firefox の Web Developer プラグインを使用すると、CSS インラインを編集して新しいページデザインを作成できます。

3. CSS Edit
CSS Edit は、Macintosh 用の独立型の CSS エディターで、指定したページからすべての既存のスタイルを抽出して上書きすることができます。

最初に単純な要素を編集する

Begin by editing simple elements and checking that they work. By making changes, then checking that each one worked, you can easily isolate any CSS code that is causing problems. Be aware that some page elements are more suited to customisation than others. For example, adding a gradient to the toolbar is less likely to 'break' the page than changing the page width. Editing reasonably static elements such as background graphics will render more predictably than designs which attempt to completely change the user interface or the Javascript-powered drop-down menus (which we don't recommend editing).

注意

Note: By default, only system administrators can edit the CSS for a space or for the site. To allow any user with Space Admin permissions to edit the CSS for a space, go to  > General Configuration > Security Configuration and select Custom Stylesheets for Spaces.

最終更新日: 2015 年 12 月 2 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.