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?

More than 5 years have passed since last update.

レスポンシブ対応 画像付きテーブル

0
Posted at

HTML

test.php
<div class="event_prize">
	<table class="event_prize-table">
		<tbody>
		<tr>
			<th>
				1位
			</th>
			<td class="prize-table-img">
				<img src="img/test_icon1.png" alt="アイコン1">
			</td>
			<td>
				テスト1
			</td>
		</tr>
		</tbody>
		<tbody>
		<tr>
			<th>
				2位
			</th>
			<td class="prize-table-img">
				<img src="img/test_icon2.png" alt="アイコン2">
			</td>
			<td>
				テスト2
			</td>
		</tr>
		</tbody>
		<tbody>
		<tr>
			<th>
				3位
			</th>
			<td class="prize-table-img">
				<img src="img/test_icon3.png" alt="アイコン3">
			</td>
			<td>
				テスト3
			</td>
		</tr>
		</tbody>
	</table>
</div>

SCSS

_test.scss
.event_prize {
    table.event_prize-table {
		width: 100%;
		max-width: 640px;
		margin: auto;
		border: 1px solid rgba(#c9c9c9, 1);

		tbody {
			border-bottom: 1px solid rgba(#c9c9c9, 1);

			th {
				display: block;
				padding: 5px;
				border-bottom: 1px solid rgba(#c9c9c9, 1);
				background: #353535;
				font-family:FOT-ロダンNTLG Pro EB;
				font-size: 16px;
				line-height: (20/16);
			}

			td {
				display: block;
				padding: 3px 10px 10px;
				font-size: 13px;
				line-height: (16/13);
				text-align: center;
			}

			td.special_icon {
				margin-top: -10px;
			}

			td.prize-table-img {
				padding: 10px 10px 0;

				img {
					width: 60px;
					height: 60px;
				}
			}
		}
	}
}

@media only screen and (min-width: 768px) {
  .event_prize {
		table.event_prize-table {
			tbody {
				th {
					display: table-cell;
					width: 25%;
					padding: 10px 10px;
					border-right: 1px solid rgba(#c9c9c9, 1);
					font-size: 18px;
					line-height: (22/18);
					vertical-align: middle;
				}

				td {
					display: table-cell;
					width: 60%;
					padding: 10px;
					font-size: 14px;
					line-height: (17/14);
					text-align: left;
				}

				td.special_icon {
					margin-top: 0;
				}

				td.prize-table-img {
					width: 10%;
					padding: 10px 0 10px 10px;
					text-align: center;

					img {
						width: 60px;
						height: 60px;
					}
				}
			}
		}
    }
}
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?