Skip to content

Instantly share code, notes, and snippets.

@furenku
Last active June 24, 2018 01:08
Show Gist options
  • Save furenku/2fe3b2d0d3da99aa22f38b6b7d2abb74 to your computer and use it in GitHub Desktop.
Save furenku/2fe3b2d0d3da99aa22f38b6b7d2abb74 to your computer and use it in GitHub Desktop.
solgrid
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>
Grid Solgrid
</h1>
<?php
$image_left = false;
$background_dark = false;
for( $i=0; $i<8; $i++ ) :
$classes = 'item';
if( $i%2 == 0 ) {
$image_left = ! $image_left;
}
if( $i%2 == 1 ) {
$background_dark = ! $background_dark;
}
if( $image_left ) {
$classes .= " image-left";
}
if( $background_dark ) {
$classes .= " background-dark";
} else {
$classes .= " background-light";
}
?>
<li class="<?php echo $classes; ?>">
<div class="text">Lorem ipsum dolor sit amet consectetur adipisicing elit. Vitae.</div>
<div class="image"><img src="http://fakeimg.pl/300x300" alt=""></div>
</li>
<?php
endfor;
?>
</body>
</html>
html, body, ul, li {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
.item {
box-sizing: border-box;
float: left;
width: 50%;
padding: 2rem;
display: flex;
align-items: stretch;
}
.item > * {
float: left;
width: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.text {
order: 0
}
.image {
order: 1
}
.background-light {
background-color: #ddd;
color: #000;
}
.background-dark {
background-color: #333;
color: #fff;
}
.image-left .image {
order: 0
}
.image-left .text {
order: 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment