I need a magnifying glass to be on the right side. Initially, everything was in place, and now it has collapsed. I can not find the error.

*{ margin: 0; padding: 0; } form { position: relative; margin: 0 auto; } .search { width: 675px; /* Π¨ΠΈΡ€ΠΈΠ½Π° поля с ΠΊΠ½ΠΎΠΏΠΊΠΎΠΉ */ border: 1px solid #8d9e7a; /* ΠŸΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹ Ρ€Π°ΠΌΠΊΠΈ */ border-radius: 5px; min-height: 20px; /* Минимальная высота */ padding: 18px 30px 17px; margin: 50px auto; box-shadow: 0 3px 3px #9ea792; } } input[type="search"] { font-family: "Roboto"; font-size: 3.36ΠΏΡ‚; line-height: 7.2ΠΏΡ‚; color: #90a4ae; border: none; /* Π£Π±ΠΈΡ€Π°Π΅ΠΌ Ρ€Π°ΠΌΠΊΡƒ */ outline: none; /* Π£Π±ΠΈΡ€Π°Π΅ΠΌ свСчСниС Π² Chrome ΠΈ Safari */ -webkit-appearance: none; /* Π£Π±ΠΈΡ€Π°Π΅ΠΌ Ρ€Π°ΠΌΠΊΡƒ Π² Chrome ΠΈ Safari */ vertical-align: middle; /* Π’Ρ‹Ρ€Π°Π²Π½ΠΈΠ²Π°Π½ΠΈΠ΅ ΠΏΠΎ сСрСдинС */ } input [type="submit"] { color: #9aa38c; position: absolute; right: 20px; top: 20px; font-size: 22px; cursor: pointer; width: 20px; /* Π¨ΠΈΡ€ΠΈΠ½Π° ΠΊΠ½ΠΎΠΏΠΊΠΈ */ height: 20px; /* Высота ΠΊΠ½ΠΎΠΏΠΊΠΈ */ border: none; /* Π£Π±ΠΈΡ€Π°Π΅ΠΌ Ρ€Π°ΠΌΠΊΡƒ */ font-family: FontAwesome;*/ } 
 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/solid.css" integrity="sha384-v2Tw72dyUXeU3y4aM2Y0tBJQkGfplr39mxZqlTBDUZAb9BGoC40+rdFCG0m10lXk" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/fontawesome.css" integrity="sha384-q3jl8XQu1OpdLgGFvNRnPdj5VIlCvgsDQTQB6owSOHWlAurxul7f+JpUOVdAiJ5P" crossorigin="anonymous"> <link rel="stylesheet" href="css/style.css"> </head> <body> <div class="wrapper"> <div class="container"> <form> <div class="search"> <input type="search" placeholder = "Search Your Keywords . . ."> <i class="fa fa-search" aria-hidden="true"></i> </div> </form> </div> </div> </body> = "https://use.fontawesome.com/releases/v5.0.8/css/fontawesome.css" integrity = "sha384-q3jl8XQu1OpdLgGFvNRnPdj5VIlCvgsDQTQB6owSOHWlAurxul7f + JpUOVdAiJ5P" crossorigin = "anonymous"> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/solid.css" integrity="sha384-v2Tw72dyUXeU3y4aM2Y0tBJQkGfplr39mxZqlTBDUZAb9BGoC40+rdFCG0m10lXk" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/fontawesome.css" integrity="sha384-q3jl8XQu1OpdLgGFvNRnPdj5VIlCvgsDQTQB6owSOHWlAurxul7f+JpUOVdAiJ5P" crossorigin="anonymous"> <link rel="stylesheet" href="css/style.css"> </head> <body> <div class="wrapper"> <div class="container"> <form> <div class="search"> <input type="search" placeholder = "Search Your Keywords . . ."> <i class="fa fa-search" aria-hidden="true"></i> </div> </form> </div> </div> </body> 

  • When playing your example, it is on the right (not clear). - LFC
  • one
    My recommendation Ρ‡Ρ‚ΠΎΠ± ошибок Π½Π° Π½Π°Ρ‡Π°Π»ΡŒΠ½ΠΎΠΌ этапС Π±Ρ‹Π»ΠΎ мСньшС - ΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚ΠΈΡ€ΡƒΠΉΡ‚Π΅ ΠΊΠ°ΠΆΠ΄Ρ‹ΠΉ шаг (ΠΊΠ°ΠΆΠ΄Ρ‹ΠΉ!!!). you is that Ρ‡Ρ‚ΠΎΠ± ошибок Π½Π° Π½Π°Ρ‡Π°Π»ΡŒΠ½ΠΎΠΌ этапС Π±Ρ‹Π»ΠΎ мСньшС - ΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚ΠΈΡ€ΡƒΠΉΡ‚Π΅ ΠΊΠ°ΠΆΠ΄Ρ‹ΠΉ шаг (ΠΊΠ°ΠΆΠ΄Ρ‹ΠΉ!!!). Yes, this is probably unnecessary work, but these actions will relieve you of such situations and introduce understanding into your code, both from your side and from other developers (all the same, if you minify, comments will be removed). The same story with the JS, but there except comments, I recommend checking everything through console.log(); . - LFC
  • 2
    can through the debugger after all and not through console.log(); ? - ishidex2

1 answer 1

You can add the float: right property to the icon or do the same, but on flex.

 *{ margin: 0; padding: 0; } /*Icon wrapper*/ .icon-wrap { float: right; } form { position: relative; margin: 0 auto; } .search { width: 675px; /* Π¨ΠΈΡ€ΠΈΠ½Π° поля с ΠΊΠ½ΠΎΠΏΠΊΠΎΠΉ */ border: 1px solid #8d9e7a; /* ΠŸΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹ Ρ€Π°ΠΌΠΊΠΈ */ border-radius: 5px; min-height: 20px; /* Минимальная высота */ padding: 18px 30px 17px; margin: 50px auto; box-shadow: 0 3px 3px #9ea792; } } input[type="search"] { font-family: "Roboto"; font-size: 3.36ΠΏΡ‚; line-height: 7.2ΠΏΡ‚; color: #90a4ae; border: none; /* Π£Π±ΠΈΡ€Π°Π΅ΠΌ Ρ€Π°ΠΌΠΊΡƒ */ outline: none; /* Π£Π±ΠΈΡ€Π°Π΅ΠΌ свСчСниС Π² Chrome ΠΈ Safari */ -webkit-appearance: none; /* Π£Π±ΠΈΡ€Π°Π΅ΠΌ Ρ€Π°ΠΌΠΊΡƒ Π² Chrome ΠΈ Safari */ vertical-align: middle; /* Π’Ρ‹Ρ€Π°Π²Π½ΠΈΠ²Π°Π½ΠΈΠ΅ ΠΏΠΎ сСрСдинС */ } input [type="submit"] { color: #9aa38c; position: absolute; right: 20px; top: 20px; font-size: 22px; cursor: pointer; width: 20px; /* Π¨ΠΈΡ€ΠΈΠ½Π° ΠΊΠ½ΠΎΠΏΠΊΠΈ */ height: 20px; /* Высота ΠΊΠ½ΠΎΠΏΠΊΠΈ */ border: none; /* Π£Π±ΠΈΡ€Π°Π΅ΠΌ Ρ€Π°ΠΌΠΊΡƒ */ font-family: FontAwesome;*/ } 
 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/solid.css" integrity="sha384-v2Tw72dyUXeU3y4aM2Y0tBJQkGfplr39mxZqlTBDUZAb9BGoC40+rdFCG0m10lXk" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/fontawesome.css" integrity="sha384-q3jl8XQu1OpdLgGFvNRnPdj5VIlCvgsDQTQB6owSOHWlAurxul7f+JpUOVdAiJ5P" crossorigin="anonymous"> <link rel="stylesheet" href="css/style.css"> </head> <body> <div class="wrapper"> <div class="container"> <form> <div class="search"> <input type="search" placeholder = "Search Your Keywords . . ."> <span class="icon-wrap"><i class="fa fa-search" aria-hidden="true"></i></span> </div> </form> </div> </div> </body> = "https://use.fontawesome.com/releases/v5.0.8/css/fontawesome.css" integrity = "sha384-q3jl8XQu1OpdLgGFvNRnPdj5VIlCvgsDQTQB6owSOHWlAurxul7f + JpUOVdAiJ5P" crossorigin = "anonymous"> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/solid.css" integrity="sha384-v2Tw72dyUXeU3y4aM2Y0tBJQkGfplr39mxZqlTBDUZAb9BGoC40+rdFCG0m10lXk" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/fontawesome.css" integrity="sha384-q3jl8XQu1OpdLgGFvNRnPdj5VIlCvgsDQTQB6owSOHWlAurxul7f+JpUOVdAiJ5P" crossorigin="anonymous"> <link rel="stylesheet" href="css/style.css"> </head> <body> <div class="wrapper"> <div class="container"> <form> <div class="search"> <input type="search" placeholder = "Search Your Keywords . . ."> <span class="icon-wrap"><i class="fa fa-search" aria-hidden="true"></i></span> </div> </form> </div> </div> </body>