0

Столкнулась с проблемой,не могу сделать input резиновый,надо чтобы он был изначально 850px,а затем уменьшался по мере уменьшения разрешения экрана,искала в интернете - пишут что надо делать ширину через проценты,так и не поняла как сделать в моем случае,помогите пожалуйста

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./assets/style.css">
</head>
<body>
    <div class="wrapper">
        <header class="header header__container">

            <div class=" header__menu">
                <div class=" logo__menu">
                    <img href='#' alt='logo'>
                </div>

            </div>
            <div class="search search_menu">
                <form action="/search/" class="form">
                    <input type="text" class="loop" value="&#128269;">
                    <input type="search" class="input__search" name="text" required                       placeholder="Найти...">

                </form>
            </div>
            
            
            <div class="avatat avatar_menu">
                <span class="avatat__name">Константин</span>
                <img class="avatar__img" href='#' alt='avatar'>
            </div>
                
              
            
        </header>
        <main class="main">
            dd
        </main>
        
    </div>
    
</body>
</html>

body {
    box-sizing: border-box;
    overflow-x: hidden;
    line-height: 1;
    
}
  

a {
  text-decoration: none;
}

.wrapper {
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  flex-direction: column;
}

.main {
  flex: 1 1 auto;
}
input {
  outline:none;
}

/* header------------------------------------------------------ */

.header {
  height: 80px;
}
.logo__menu{
  margin-top: 25px;
}

.header__container {
  overflow: hidden;
  display: flex;
  flex-direction: row;
  max-width: 1240px;
  margin: 0 auto;
  background-color: #F9F1E7;
}



 .loop{
  width: 24px;

 }
 .form{
  display: flex;

 }
 .input__search{
  height: 40px;
  border:none;
  width:819px;
 }
.search_menu{
  border:1px solid #BBC4D6;
  border-radius: 3px;
  display: flex;
  margin-top: 20px;
  margin-left: 60px;
  height: 40px;
  width:850px;
}
.avatat{
  display: flex;
  border-left: 1px solid #EBEBF1;
}
.avatar_menu{
  margin-left: 60px;
}
.avatat__name{
  padding-top: 31px;
  padding-left: 19px;

}
.avatar__img{
  padding-left: 10px;
  padding-top: 20px;

}



2
  • 1
    max-width: 850px; width: 100%;
    – soledar10
    2 окт 2022 в 15:55
  • Спасибо,получилось 2 окт 2022 в 18:27

1 ответ 1

0

body {
  box-sizing: border-box;
  overflow-x: hidden;
  line-height: 1;
}

a {
  text-decoration: none;
}

.wrapper {
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  flex-direction: column;
}

.main {
  flex: 1 1 auto;
}

input {
  outline: none;
}


/* header------------------------------------------------------ */

.header {
  height: 80px;
}

.logo__menu {
  margin-top: 25px;
}

.header__container {
  overflow: hidden;
  display: flex;
  flex-direction: row;
  max-width: 1240px;
  margin: 0 auto;
  background-color: #F9F1E7;
}

.loop {
  width: 24px;
}

.form {
  display: flex;
}

.input__search {
  height: 40px;
  border: none;
  width: 100%;
}

.search_menu {
  border: 1px solid #BBC4D6;
  border-radius: 3px;
  display: flex;
  margin-top: 20px;
  margin-left: 60px;
  height: 40px;
  max-width: 850px;
  width: 100%;
}

.avatat {
  display: flex;
  border-left: 1px solid #EBEBF1;
}

.avatar_menu {
  margin-left: 60px;
}

.avatat__name {
  padding-top: 31px;
  padding-left: 19px;
}

.avatar__img {
  padding-left: 10px;
  padding-top: 20px;
}
<div class="wrapper">
  <header class="header header__container">

    <div class=" header__menu">
      <div class=" logo__menu">
        <img href='#' alt='logo'>
      </div>

    </div>
    <div class="search search_menu">
      <form action="/search/" class="form">
        <input type="text" class="loop" value="&#128269;">
        <input type="search" class="input__search" name="text" required placeholder="Найти...">
      </form>
    </div>


    <div class="avatat avatar_menu">
      <span class="avatat__name">Константин</span>
      <img class="avatar__img" href='#' alt='avatar'>
    </div>



  </header>
  <main class="main">
    dd
  </main>

</div>

Забудьте вообще про px возле width | height Если надо как-то ограничить блоки используються только max-width max-height

Ваш ответ

Нажимая на кнопку «Отправить ответ», вы соглашаетесь с нашими условиями использования и подтверждаете, что прочитали и поняли наши политику конфиденциальности и нормы поведения.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.