Adaptive video list on grid. HTML + CSS example open

Adaptive video list on grid. HTML + CSS example

Approved. Code works!
This is exactly the working code that is verified by the moderator or site administrators

HTML

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<link rel="stylesheet" href="css/style.css">
		<title>Adaptive video</title>
	</head>
	<body>
		<div class="wrapper">
			
			 
		
			
		
			<div class="items">
				<div class="items__container">
					<div class="items__body">
						<div class="item">
							<div class="item__video">
								<video poster="" controls preload="metadata">
									<source type="video/webm" src="https://lil-code.com/wp-content/uploads/2022/04/test-video1.webm">
									<source type="video/mp4" src="https://lil-code.com/wp-content/uploads/2022/04/test-video1.mp4">
								</video>
							</div>
							<div class="item__text">
								Lorem ipsum, dolor sit amet consectetur adipisicing elit.
							</div>
						</div>
						<div class="item">
							<div class="item__video">
								<iframe src="https://www.youtube.com/embed/1La4QzGeaaQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
							</div>
							<div class="item__text">
								Lorem ipsum, dolor sit amet consectetur adipisicing elit. Lorem ipsum, dolor sit amet consectetur adipisicing elit.
							</div>
						</div>
						<div class="item">
							<div class="item__video">
								<video poster="img/forest-poster.jpg" controls preload="metadata">
									<source type="video/webm" src="https://lil-code.com/wp-content/uploads/2022/04/test-video1.webm">
									<source type="video/mp4" src="https://lil-code.com/wp-content/uploads/2022/04/test-video1.mp4">
								</video>
							</div>
							<div class="item__text">
								Lorem ipsum, dolor sit amet consectetur adipisicing elit.
							</div>
						</div>
						<div class="item">
							<div class="item__video">
								<video poster="img/forest-poster.jpg" controls preload="metadata">
									<source type="video/webm" src="https://lil-code.com/wp-content/uploads/2022/04/test-video1.webm">
									<source type="video/mp4" src="https://lil-code.com/wp-content/uploads/2022/04/test-video1.mp4">
								</video>
							</div>
							<div class="item__text">
								Lorem ipsum, dolor sit amet consectetur adipisicing elit. Lorem ipsum, dolor sit amet consectetur adipisicing elit. Lorem ipsum, dolor sit amet consectetur adipisicing elit.
							</div>
						</div>
					</div>
				</div>
			</div>
			 -->
		</div>
	</body>
</html>


CSS


*,
*::before,
*::after {
	padding: 0;
	margin: 0;
	border: 0;
	box-sizing: border-box;
}
a {
	text-decoration: none;
}
ul,
ol,
li {
	list-style: none;
}
img {
	vertical-align: top;
}
h1,
h2,
h3,
h4,
h5,
h6 {
	font-weight: inherit;
	font-size: inherit;
}
html,
body {
	height: 100%;
	line-height: 1;
	font-size: 14px;
	background-color: #333;
	color: #fff;
	font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

h1 {
	font-size: 30px;
	margin: 0px 0px 30px 0px;
}
.wrapper {
	min-height: 100vh;
	display: flex;
	flex-direction: column;

 
	justify-content: center;
	align-items: center;

}
/* ------------------ */



.full-screen {
	position: relative;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}
.full-screen__body {
	padding: 50px 15px;
	background-color: rgba(0, 0, 0, 0.5);
	position: relative;
	z-index: 2;
	display: flex;
	flex: 1 1 auto;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	text-transform: uppercase;
}
.full-screen__title {
	font-size: 50px;
	letter-spacing: 25px;
	font-weight: 700;
	margin: 0px 0px 20px 0px;
}
.full-screen__text {
	font-size: 18px;
	letter-spacing: 15px;
}
.full-screen__video {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.content {
	position: relative;
	z-index: 5;
	background-color: #794f45;
}
.content__container {
	max-width: 1200px;
	margin: 0px auto;
	padding: 50px 15px;
	font-size: 18px;
	line-height: 150%;
}
.content__container p {
	margin: 0px 0px 20px 0px;
}
 


/* aspect-ratio: 16 / 9;  */

.items {
	padding: 50px 0;
}
.items__container {
	max-width: 1200px;
	padding: 0px 15px;
	margin: 0px auto;
}
.items__body {
	display: grid;
	gap: 20px;
	grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}
.item {
}
.item__video {
	position: relative;
	margin: 0px 0px 15px 0px;
	padding: 0px 0px 56% 0px;
}
.item__video video,
.item__video iframe {
	object-fit: cover;
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

.item__text {
	font-size: 18px;
	line-height: 150%;
}

Result

0

More

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation