私は3つのボックスで練習しています。それは私が箱のための余白を持っていないときにしたいことが大好きです。しかし、マージンを追加すると、望ましい結果が得られません。それから私は45%のようなパーセンテージを使用しなければなりません。しかし、マージンを考慮して50%も使用することはできないのですか?応答性の問題を引き起こすマージン
ここに私のコードです。可能であれば、いくつかの説明を非常に感謝します。ボックスのサイズ変更と
* {
\t box-sizing: border-box;
}
body {
\t background-color: lightblue;
}
.container {
\t display: flex;
\t flex-wrap: wrap;
}
.box {
\t width: 100%;
\t height: 100px;
}
.blue {
\t background-color: orange;
\t width: 100%
}
.red {
\t background-color: red;
}
.green {
\t background-color: green;
}
@media screen and (min-width: 500px) {
\t .blue {
\t \t width: 50%;
\t }
\t .red {
\t \t width: 50%;
\t }
\t
}
@media screen and (min-width: 700px) {
\t .blue {
\t \t width: 33%;
\t }
\t .red {
\t \t width: 33%;
\t }
\t .green {
\t \t width: 33%;
\t }
\t
}
<!DOCTYPE html>
<html>
<head>
\t <title>Testing</title>
\t <link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
<div class="container">
<div class="box blue"></div>
<div class="box red"></div>
<div class="box green"></div> \t
</div>
</body>
</html>
はい、%を使用して間隔を割り当てることができます。 – frnt