Помогите с картинкой от 450px
Начиная с 450px, картинка выходит за пределы экрана. Это можно предотвратить только с помощью @media? Если да, то просто напишите да). И не обращайте на мусор))
<!DOCTYPE html>
<html lang="ru">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" media="all" href="style.css">
<meta name="description" content="">
<meta name="viewport" content="width=device-width; initial-scale=1">
<meta name="keywords" content="">
<title>QBet.fun</title>
</head>
<body>
<!-----------------------ШАПКА----------------------->
<div class="header">
<div class="text_header">
<!----------------PC MENU---------------------------->
<div class="header_logo"><a href=""><b>QBet</b></a></div>
<div class="menu">
<a href="">Мобильные</a>
<a href="">Играть</a>
<a href="">Советы</a>
<a href="">Программы</a>
</div>
<!----------------/PC MENU---------------------------->
<!----------------MOBILE MENU---------------------------->
<div class="wrapper">
<input type="checkbox" id="check-menu">
<label for="check-menu"></label>
<div class="burger-line first"></div>
<div class="burger-line second"></div>
<div class="burger-line third"></div>
<div class="burger-line fourth"></div>
<nav class="main-menu">
<a href="#">Мобильные</a>
<a href="#">Играть</a>
<a href="#">Советы</a>
<a href="#">Программы</a>
</nav>
</div>
<!----------------/MOBILE MENU---------------------------->
</div>
</div>
<!-----------------------/ШАПКА----------------------->
<div class="main">
<div class="text_main">
<p>Lorem Ipsum - это текст-"рыба", часто используемый в печати и вэб-дизайне. Lorem Ipsum является стандартной "рыбой" для текстов на латинице с начала XVI века. В то время некий безымянный печатник создал большую коллекцию размеров и форм шрифтов, используя Lorem Ipsum для распечатки образцов. Lorem Ipsum не только успешно пережил без заметных изменений пять веков, но и перешагнул в электронный дизайн. Его популяризации в новое время послужили публикация листов Letraset с образцами Lorem Ipsum в 60-х годах и, в более недавнее время, программы электронной вёрстки типа Aldus PageMaker, в шаблонах которых используется Lorem Ipsum.</p>
</div>
<div class="banner">
<a href="#"><img src="D:/Warhummer.jpg" alt="" width="468" height="60"></a>
</div>
</div>
<!------------------ПОДВАЛ------------------>
<div class="footer">QBet.fun
<div class="s1">[email protected]</div>
</div>
</body>
</html>
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
a {
color: #fff;
text-decoration: none;
}
/*--------------PC MENU----------------*/
.header {
background-color: #000;
padding-right: 50px;
padding-left: 50px;
font-family: sans-serif;
}
.text_header {
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
justify-content: space-between;
-ms-align-items: center;
align-items: center;
padding-bottom: 20px;
padding-top: 20px;
}
.header_logo {
font-size: 26px;
}
.header_logo b:hover {
color: #FA332DFF;
transition: .3s;
}
.menu {
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
justify-content: flex-end;
}
.menu a {
margin-right: 60px;
font-size: 20px;
}
.menu a:hover {
color: #FA332DFF;
transition: .3s;
}
/*--------------/PC MENU----------------*/
/*--------------MOBILE MENU----------------*/
.main-menu a:hover {
background-color: #FA332DFF;
transition: .3s;
}
.wrapper {
display: none;
width: 320px;
background-color: #000;
position: relative;
color: white;
text-align: center;
height: 40px;
font-family: 'Arial';
}
#check-menu{
display: none;
}
label{
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
cursor: pointer;
z-index: 2;
line-height: 40px;
}
.burger-line{
position: absolute;
top: 8px;
right: 10px;
width: 35px;
height: 2px;
background-color: #fff;
transition: .5s all;
}
.second, .third{
top: 18px;
}
.fourth{
top: 28px;
}
.main-menu{
display: block;
position: absolute;
width: 100%;
bottom: 0;
left: 0;
transform: translateY(100%);
max-height: 0;
font-size: 0;
overflow: hidden;
transition: .5s all;
}
.main-menu a{
display: block;
width: 100%;
padding: 10px;
color: white;
text-decoration: none;
border-top: 1px solid #ccc;
background-color: #000;
}
#check-menu:checked ~ .main-menu{
max-height: 500px;
font-size: 16px;
}
#check-menu:checked ~ .first{
display: none;
}
#check-menu:checked ~ .second{
transform: rotate(45deg);
}
#check-menu:checked ~ .third{
transform: rotate(-45deg);
}
#check-menu:checked ~ .fourth{
display: none;
}
/*--------------/MOBILE MENU----------------*/
.main {
font-family: sans-serif;
line-height: 24px;
padding-top: 20px;
padding-bottom: 20px;
width: 90%;
margin: 0 auto;
}
.text_main {
margin-bottom: 20px;
}
/*----------------БАННЕР----------------*/
.banner {
text-align: center;
}
/*----------------/БАННЕР----------------*/
/* Подвал сайта */
.footer {
background-color: #000;
color: #ccc;
padding-top: 15px;
padding-bottom: 15px;
font-family: sans-serif;
text-align: center;
}
.s1 {
margin: 10px 0;
}
@media screen and (max-width: 992px) {
.wrapper {
display: block;
}
.menu {
display: none;
}
}
@media screen and (max-width: 360px) {
.header {
padding-right: 15px;
padding-left: 15px;
}
}
Ответы (1 шт):
Автор решения: Sevastopol'
→ Ссылка
Зачем вам @media? Для картинок поставьте:
.text_main img,
.banner img {
max-width: 100%;
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
a {
color: #fff;
text-decoration: none;
}
.text_main img {
max-width: 100%;
}
/*--------------PC MENU----------------*/
.header {
background-color: #000;
padding-right: 50px;
padding-left: 50px;
font-family: sans-serif;
}
.text_header {
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
justify-content: space-between;
-ms-align-items: center;
align-items: center;
padding-bottom: 20px;
padding-top: 20px;
}
.header_logo {
font-size: 26px;
}
.header_logo b:hover {
color: #FA332DFF;
transition: .3s;
}
.menu {
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
justify-content: flex-end;
}
.menu a {
margin-right: 60px;
font-size: 20px;
}
.menu a:hover {
color: #FA332DFF;
transition: .3s;
}
/*--------------/PC MENU----------------*/
/*--------------MOBILE MENU----------------*/
.main-menu a:hover {
background-color: #FA332DFF;
transition: .3s;
}
.wrapper {
display: none;
width: 320px;
background-color: #000;
position: relative;
color: white;
text-align: center;
height: 40px;
font-family: 'Arial';
}
#check-menu {
display: none;
}
label {
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
cursor: pointer;
z-index: 2;
line-height: 40px;
}
.burger-line {
position: absolute;
top: 8px;
right: 10px;
width: 35px;
height: 2px;
background-color: #fff;
transition: .5s all;
}
.second,
.third {
top: 18px;
}
.fourth {
top: 28px;
}
.main-menu {
display: block;
position: absolute;
width: 100%;
bottom: 0;
left: 0;
transform: translateY(100%);
max-height: 0;
font-size: 0;
overflow: hidden;
transition: .5s all;
}
.main-menu a {
display: block;
width: 100%;
padding: 10px;
color: white;
text-decoration: none;
border-top: 1px solid #ccc;
background-color: #000;
}
#check-menu:checked~.main-menu {
max-height: 500px;
font-size: 16px;
}
#check-menu:checked~.first {
display: none;
}
#check-menu:checked~.second {
transform: rotate(45deg);
}
#check-menu:checked~.third {
transform: rotate(-45deg);
}
#check-menu:checked~.fourth {
display: none;
}
/*--------------/MOBILE MENU----------------*/
.main {
font-family: sans-serif;
line-height: 24px;
padding-top: 20px;
padding-bottom: 20px;
width: 90%;
margin: 0 auto;
}
.text_main {
margin-bottom: 20px;
}
/*----------------БАННЕР----------------*/
.banner {
text-align: center;
}
/*----------------/БАННЕР----------------*/
/* Подвал сайта */
.footer {
background-color: #000;
color: #ccc;
padding-top: 15px;
padding-bottom: 15px;
font-family: sans-serif;
text-align: center;
}
.s1 {
margin: 10px 0;
}
@media screen and (max-width: 992px) {
.wrapper {
display: block;
}
.menu {
display: none;
}
}
@media screen and (max-width: 360px) {
.header {
padding-right: 15px;
padding-left: 15px;
}
}
<!-----------------------ШАПКА----------------------->
<div class="header">
<div class="text_header">
<!----------------PC MENU---------------------------->
<div class="header_logo"><a href=""><b>QBet</b></a></div>
<div class="menu">
<a href="">Мобильные</a>
<a href="">Играть</a>
<a href="">Советы</a>
<a href="">Программы</a>
</div>
<!----------------/PC MENU---------------------------->
<!----------------MOBILE MENU---------------------------->
<div class="wrapper">
<input type="checkbox" id="check-menu">
<label for="check-menu"></label>
<div class="burger-line first"></div>
<div class="burger-line second"></div>
<div class="burger-line third"></div>
<div class="burger-line fourth"></div>
<nav class="main-menu">
<a href="#">Мобильные</a>
<a href="#">Играть</a>
<a href="#">Советы</a>
<a href="#">Программы</a>
</nav>
</div>
<!----------------/MOBILE MENU---------------------------->
</div>
</div>
<!-----------------------/ШАПКА----------------------->
<div class="main">
<div class="text_main">
<p><img src="https://wallpapercave.com/wp/wp3110137.jpg"></p>
<p>Lorem Ipsum - это текст-"рыба", часто используемый в печати и вэб-дизайне. Lorem Ipsum является стандартной "рыбой" для текстов на латинице с начала XVI века. В то время некий безымянный печатник создал большую коллекцию размеров и форм шрифтов, используя
Lorem Ipsum для распечатки образцов. Lorem Ipsum не только успешно пережил без заметных изменений пять веков, но и перешагнул в электронный дизайн. Его популяризации в новое время послужили публикация листов Letraset с образцами Lorem Ipsum в 60-х
годах и, в более недавнее время, программы электронной вёрстки типа Aldus PageMaker, в шаблонах которых используется Lorem Ipsum.</p>
</div>
<div class="banner">
<a href="#"><img src="D:/Warhummer.jpg" alt="" width="468" height="60"></a>
</div>
</div>
<!------------------ПОДВАЛ------------------>
<div class="footer">QBet.fun
<div class="s1">[email protected]</div>
</div>