# ヘッダー以下の要素を右にシフトさせる方法を探しています

**URL:** https://meta.discourse.org/t/looking-for-a-way-to-shift-everything-below-the-header-to-the-right/127503
**Category:** Support
**Created:** [2019 年 9 月 3 日午後 4:32 UTC](https://meta.discourse.org/t/looking-for-a-way-to-shift-everything-below-the-header-to-the-right/127503 "2019-09-03T16:32:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![orchardstreet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orchardstreet/32/149531_2.png) [@orchardstreet](https://meta.discourse.org/u/orchardstreet)
#### Post date: [2019 年 9 月 3 日午後 4:32 UTC](https://meta.discourse.org/t/looking-for-a-way-to-shift-everything-below-the-header-to-the-right/127503/1 "2019-09-03T16:32:02Z")

</div>

投稿が含まれるページでのみ

もし私の意図が不明確な場合のために、この CSS が私の要望通りに機能することを示します

```
#main-outlet{
margin-left: 15%;
}

```

ただし、投稿のあるページだけでなく、すべてのページで右側にシフトしてしまいます  
CSS をずっと試行錯誤していますが、何かご意見はありますか？  
ありがとうございます！

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [2019 年 9 月 3 日午後 4:57 UTC](https://meta.discourse.org/t/looking-for-a-way-to-shift-everything-below-the-header-to-the-right/127503/2 "2019-09-03T16:57:33Z")

</div>

なぜそうしたいのか、すぐにわかりませんが、トピックページの `<body>` タグには、ユニークなクラスが追加されています。そのクラスは `archetype-regular` です。

これを使って、以下のようにスタイル変更のスコープを限定できます。

```plaintext
.archetype-regular {
  #main-outlet {
    // スタイルをここに記述
  }
}

```

パーソナルメッセージページにも同様の仕組みがあり、その場合は `archetype-private_message` というクラスが使用されます。

PM ページにも変更を適用したい場合は、上記の CSS にセレクターを追加して以下のように記述します。

```plaintext
.archetype-regular,
.archetype-private_message {
  #main-outlet {
    // スタイルをここに記述
  }
}

```

ただし、`#main-outlet` のマージンを変更すると、予期せぬ影響が出る可能性があることにご注意ください。詳しくは[こちら](https://meta.discourse.org/t/displaced-user-card-need-some-help-with-css/95006/6?u=johani)をご覧ください。

---

<div class="post-metadata">

### Author: ![orchardstreet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orchardstreet/32/149531_2.png) [@orchardstreet](https://meta.discourse.org/u/orchardstreet)
#### Post date: [2019 年 9 月 3 日午後 6:00 UTC](https://meta.discourse.org/t/looking-for-a-way-to-shift-everything-below-the-header-to-the-right/127503/3 "2019-09-03T18:00:22Z")

</div>

> [@Johani](#):
>
> .archetype-regular { #main-outlet { // スタイルをここに記述 } }

非常に参考になりました、ありがとうございます！

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2019 年 10 月 3 日午後 6:00 UTC](https://meta.discourse.org/t/looking-for-a-way-to-shift-everything-below-the-header-to-the-right/127503/4 "2019-10-03T18:00:29Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
