Skip to content

Instantly share code, notes, and snippets.

@alex-boom
Last active May 24, 2019 14:41
Show Gist options
  • Save alex-boom/aad5c219a9a64c2a1748dbf9cec37ce6 to your computer and use it in GitHub Desktop.
Save alex-boom/aad5c219a9a64c2a1748dbf9cec37ce6 to your computer and use it in GitHub Desktop.
grid-different-col
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
/*
example https://jsfiddle.net/w6jx5z03/2/
*/
ul {
display: grid;
grid-gap: 30px;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
/* decoration style */
margin: 10px;
padding: 10px;
list-style: none;
/*end decoration style */
> li {
/* decoration style */
background-color: #ccc;
padding: 40px;
/*end decoration style */
&:first-child {
grid-column: span 2;
grid-row: span 3;
}
}
}
</style>
</head>
<body>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Еще один пример</title>
<style>
/*
example https://jsfiddle.net/9dv1fzk3/
*/
.row-grid {
display: grid;
grid-gap: 30px;
> div {
/* decoration style */
background-color: #ccc;
padding: 40px;
/*end decoration style */
&:first-child {
grid-column: span 5;
@include media('>=tablet') {
order: 3;
}
}
&:nth-child(2) {
grid-column: span 5;
@include media('>=tablet') {
order: 2;
}
}
&:nth-child(3) {
grid-column: span 4;
@include media('>=tablet') {
order: 1;
}
}
}
}
</style>
</head>
<body>
<div class="row-grid">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment