ウィンドウ一杯に画像を表示するCSS

テスト

テスト

  • タグ:
  • タグはありません
<!-- CSS -->
<style>
img.bg {
	/* Set rules to fill background */
	min-height: 100%;
	min-width: 1024px;
	/* Set up proportionate scaling */
	width: 100%;
	height: auto;
	/* Set up positioning */
	position: fixed;
	/* またはabsolute; */
	top: 0;
	left: 0;
}

@media screen and (max-width: 1024px){
	  img.bg {
	  left: 50%;
	  margin-left: -512px; }
}

div#container {
	position: relative;
}
</style>

<!-- HTML -->
<img class="bg" src="画像.jpg" alt="" />
<div id="container">
ここにコンテンツ
</div>