Created
June 24, 2018 01:18
-
-
Save furenku/e53fb3b6916c806c1abdae8267fced92 to your computer and use it in GitHub Desktop.
solgrid sin usar flexbox order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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 Solgris | |
</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( $background_dark ) { | |
$classes .= " background-dark"; | |
} else { | |
$classes .= " background-light"; | |
} | |
?> | |
<li class="<?php echo $classes; ?>"> | |
<?php if( $image_left ) : ?> | |
<div class="image"><img src="http://fakeimg.pl/300x300" alt=""></div> | |
<div class="text">Lorem ipsum dolor sit amet consectetur adipisicing elit. Vitae.</div> | |
<?php else: ?> | |
<div class="text">Lorem ipsum dolor sit amet consectetur adipisicing elit. Vitae.</div> | |
<div class="image"><img src="http://fakeimg.pl/300x300" alt=""></div> | |
<?php endif; ?> | |
</li> | |
<?php | |
endfor; | |
?> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
.background-light { | |
background-color: #ddd; | |
color: #000; | |
} | |
.background-dark { | |
background-color: #333; | |
color: #fff; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment