01.10.2017

iPhone X на чистом CSS

iPhone X на чистом CSS

Очередной замечательный пример верстки на чистом CSS. На этот раз результатом верстки стали различные девайсы от iPhone до iMac и Apple Watch.

Подробнее можно посмотреть по ссылке.

Источник:  https://github.com/picturepan2/devices.css

<div class="device device-iphone-x">
	<div class="device-frame">
		<div class="device-content"></div>
	</div>
	<div class="device-stripe"></div>
	<div class="device-header">
		<div class="device-sensors"></div>
	</div>
	<div class="device-btns"></div>
	<div class="device-power"></div>
</div>
.device,
.device::before,
.device::after,
.device *,
.device *::before,
.device *::after {
	box-sizing: border-box;
	display: block;
}
.device {
	position: relative;
	margin: 30px auto;
}
.device .device-frame {
	z-index: 1;
}
.device-iphone-x {
	height: 694px;
	width: 342px;
}
.device-iphone-x .device-frame {
	background: #222;
	border-radius: 54px;
	box-shadow: inset 0 0 0 2px #606467, inset 0 0 0 6px #e2e3e4;
	height: 694px;
	padding: 22px;
	width: 342px;
}
.device-iphone-x .device-content {
	background-color: #fff;
	background-image: url("https://images.unsplash.com/photo-1500964757637-c85e8a162699");
	background-position: center center;
	background-size: cover;
	border-radius: 32px;
	height: 650px;
	position: relative;
	width: 300px;
}
.device-iphone-x .device-stripe::after,
.device-iphone-x .device-stripe::before {
	border: solid rgba(51, 51, 51, .25);
	border-width: 0 6px;
	content: "";
	height: 5px;
	left: 0;
	position: absolute;
	width: 100%;
	z-index: 9;
}
.device-iphone-x .device-stripe::after {
	top: 68px;
}
.device-iphone-x .device-stripe::before {
	bottom: 68px;
}
.device-iphone-x .device-header {
	background: #222;
	border-bottom-left-radius: 16px;
	border-bottom-right-radius: 16px;
	height: 24px;
	left: 50%;
	margin-left: -82px;
	position: absolute;
	top: 22px;
	width: 164px;
	z-index: 199;
}
.device-iphone-x .device-header::after,
.device-iphone-x .device-header::before {
	content: "";
	height: 6px;
	position: absolute;
	top: 0;
	width: 6px;
}
.device-iphone-x .device-header::after {
	background: radial-gradient(circle at bottom left, transparent 0, transparent 75%, #222 75%, #222 100%);
	left: -6px;
}
.device-iphone-x .device-header::before {
	background: radial-gradient(circle at bottom right, transparent 0, transparent 75%, #222 75%, #222 100%);
	right: -6px;
}
.device-iphone-x .device-sensors::after,
.device-iphone-x .device-sensors::before {
	content: "";
	position: absolute;
}
.device-iphone-x .device-sensors::after {
	background: #444;
	border-radius: 2.5px;
	height: 5px;
	left: 50%;
	margin-left: -20px;
	top: 4px;
	width: 40px;
}
.device-iphone-x .device-sensors::before {
	background: #444;
	border-radius: 50%;
	height: 11px;
	left: 50%;
	margin-left: 30px;
	top: 1px;
	width: 11px;
}
.device-iphone-x .device-btns {
	background: #606467;
	height: 26px;
	left: -2px;
	position: absolute;
	top: 92px;
	width: 3px;
}
.device-iphone-x .device-btns::after,
.device-iphone-x .device-btns::before {
	background: #606467;
	content: "";
	height: 50px;
	left: 0;
	position: absolute;
	width: 3px;
}
.device-iphone-x .device-btns::after {
	top: 48px;
}
.device-iphone-x .device-btns::before {
	top: 112px;
}
.device-iphone-x .device-power {
	background: #606467;
	height: 80px;
	position: absolute;
	right: -2px;
	top: 160px;
	width: 3px;
}

Демонстрация

Нам будет приятно

Поделитесь

Комментарии

Загрузка комментариев...