我用Moving from HTML Grid Systems to CSS Grid Systems的代碼做了一頁。但是,我的頁面無法正常工作,媒體查詢似乎無法正常工作。他們爲什麼不工作? CSS皮棉說,有一些問題CSS Lint爲什麼我的媒體查詢不起作用?
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- <meta name="viewport" content="width=device-width"> -->
<title>Flex-training</title>
<link rel="stylesheet" href="main.css" />
</head>
<body>
<div class="l-flex">
<div id="back" class="l-fg3">
<div>Featured Item</div>
<div>Featured Item</div>
<div>Grid item</div>
<div>Grid item</div>
<div>Grid item</div>
</div>
</div>
</body>
</html>
CSS:
.l-fg3 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin: -10px;
}
.l-fg3 > div {
-webkit-flex-basis: 100%;
-ms-flex-preferred-size: 100%;
flex-basis: 100%;
@media screen and (min-width: 600px) {
margin: 10px;
-webkit-flex-basis: calc(33.333%-20px);
-ms-flex-preferred-size: calc(33.333%-20px);
flex-basis: calc(33.333%-20px);
}
> div:nth-child(1),
> div:nth-child(2) {
@media (min-width: 600px) {
flex-basis: calc(50% - 20px);
}
}
}
.l-flex {
overflow-x: hidden;
}
div {
border: 0.2px solid #506183;
border-radius: 5px;
background-color: #81f6a9;
}
#back {
background-color: #36a4c3
}
這看起來像Sass(SCSS)而不是CSS。 – Moob