JSFiddle - React, Tailwind, and code Playground
by chuangchen
HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div class="container">
<div class="media clearfix">
<img height="300" width="100" src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png">
<div class="p">
margin: 10px;
</div>
<div class="p">
margin: 10px;
</div>
<div class="p">
margin: 10px;
</div>
</div>
<div style="background:blue;margin-top:20px;">22</div>
</div>
</body>
</html>
CSS
body {
background-color: #eee;
}
:root {
box-sizing: border-box;
}
*,
::before,
::after {
box-sizing: inherit;
}
body *+* {
/* margin-top: 1.5em; */
}
header {
color: #fff;
background-color: #0072b0;
border-radius: 0.5em;
padding: 0 1em;
margin-bottom: 1.5em;
}
main {
background: white;
border-radius: 0.5em;
padding: 0 1.5em;
}
.container {
margin: 0 auto;
max-width: 100%;
}
.media {
background: yellow;
/* border: 1px solid green; */
}
.clearfix::after {
display: block;
content: " ";
clear: both;
/*不会折叠到容器外面*/
margin-bottom: 20px;
}
img {
background: green;
float: left;
/* margin:10px; */
}
.p {
background: red;
margin: 10px;
margin: 0;
}