Не понимаю как убрать горизонтальный скролл, не используя при этом overflow: hidden? Новичок в вёрстке и фронте в целом
Не понимаю как убрать горизонтальный скролл, не используя при этом overflow: hidden. Почему вообще здесь появляется скролл? Вот сам код HTML и CSS соответственно:
/* Обнуляющие стили */
* {
padding: 0;
margin: 0;
border: 0;
}
*,
*:before,
*:after {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
:focus,
:active {
outline: none;
}
a:focus,
a:active {
outline: none;
}
nav,
footer,
header,
aside {
display: block;
}
html,
body {
height: 100%;
width: 100%;
font-size: 100%;
line-height: 1;
font-size: 14px;
-ms-text-size-adjust: 100%;
-moz-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
input,
button,
textarea {
font-family: inherit;
}
input::-ms-clear {
display: none;
}
button {
cursor: pointer;
}
button::-moz-focus-inner {
padding: 0;
border: 0;
}
a,
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
ul li {
list-style: none;
}
img {
vertical-align: top;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-size: inherit;
font-weight: 400;
}
/* Обнуляющие стили */
body {
margin: 8px;
}
.container {
width: 80%;
margin: 0 auto;
}
.wrapper {}
.content {}
.four-block {}
.four-block__row {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.four-block__element {
margin-bottom: 10px;
width: 24%;
height: 300px;
background-color: green;
padding: 10px;
color: #fff;
font-size: 16px;
}
@media screen and (min-width: 480px) and (max-width: 800px) {
.four-block__element {
width: 49%;
}
}
@media screen and (max-width: 480px) {
.four-block__element {
width: 100%;
}
}
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>ADAPRTIVERR</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="wrapper">
<div class="content">
<div class="four-block">
<div class="container">
<div class="four-block__row">
<div class="four-block__element">Блок 1.</div>
<div class="four-block__element">Блок 2.</div>
<div class="four-block__element">Блок 3.</div>
<div class="four-block__element">Блок 4.</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Источник: Stack Overflow на русском