0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

cocoonのカスタマイズでヘッダー画像の高さをMax800pxにしたとき

Last updated at Posted at 2024-06-02

cocoonのカスタマイズでヘッダー画像の高さをMax800pxにしたとき、横幅1024pxで下に隙間ができる件で、色々調べました。

cocoonを使ってウェブサイトを作っていますが、今回ヘッダー画像が高さMaxの800pxで作っています。
画面の横幅が1280pxの時は、綺麗に収まります。
でも横幅が1024pxの時は、ヘッダー画像のと記事のタイトルの間が、大きく空いてしまいます。
色々調べて、子テーマのCSSに下記のメディアクエリを設定すると解決しました。


@media screen and (min-width: 1023px) and (max-width: 1279px) {
	 #header {
			height: 420px;
		}

}

@media screen and (min-width: 1280px) and (max-width: 1439px) {
	 #header {
			height: 520px;
		}

}

cocoonは、画面の横幅が1024px以上でパソコン用の画面になるため、ヘッダー画像が縦400px以上を使うとヘッダー画像と記事タイトルの間に隙間ができてしまう可能性があります。

1279pxまでモバイル用のヘッダーのcssが、適用されるようにすると良いと思います。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?