Solution 1 :

  *{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}
html {
    background: rgb(237,237,237);
    background: linear-gradient(0deg, rgba(237,237,237,1) 0%, rgba(255,255,255,1) 100%);
    min-height: 100vh;

}
body {
    min-height: 100vh;
}
.searchBtn {
    float: right;
    height: 50px;
    width: 50px;
}
#searchBox{
    height: 50px;
      width: 100%;
   
}
#navbar {
     position: relative;
    display: flex;
    flex-direction: row;
     width: 100%;
    background-color: turquoise;
    min-height: 50px;
}
<div id="navbar">
    <input type="text" placeholder="Search..." id="searchBox">
    <button type="submit" class="searchBtn">Src</button>
    </div>

Problem :

How can i make a search bar with a button on the right and an input field that goes to the start of that button?

This is what i get

I want to get rid of the line break somehow.
I tried using calc(), setting width to 100%, neither of those worked.

*{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}
html {
    background: rgb(237,237,237);
    background: linear-gradient(0deg, rgba(237,237,237,1) 0%, rgba(255,255,255,1) 100%);
    min-height: 100vh;

}
body {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;

}
.searchBtn {
    float: right;
    height: 50px;
    width: 50px;
}
#searchBox{
    height: 50px;
    width: 100%;
}
#navbar {
    background-color: turquoise;
    min-height: 50px;
    top: 0;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="css2.css" rel="stylesheet">
</head>
<body>
    <div id="navbar">
    <input type="text" placeholder="Search..." id="searchBox">
    <button type="submit" class="searchBtn">Src</button>
</div>
</body>
</html>

Comments

Comment posted by Automatically resize input according to button size?

Does this answer your question?

Comment posted by w3schools.com/css/css3_flexbox.asp

You’re looking for the css css properties

Comment posted by Aleksa

@SeeoX nah, this isnt what i need, got my answer anyway, tnx

Comment posted by Aleksa

@amarinediary i needed the asnwer asap so i didnt have time to do the research, tnx

By