2

i am trying to texbox over to button but my case first line texbox then next line in button html:-

 <div class="styled-input" id="surnamediv">
                                <input type="text" id="surName" /><button id="add" class="hidden">Add</button>
                                <label>Surname</label>
                                <span></span>
                            </div>

css:-

.custom-input #surnamediv #add{
        vertical-align:middle;
    }
Dip Girase
  • 439
  • 1
  • 7
  • 18

3 Answers3

4

Try these styles

#surnamediv {
   display: flex;
   align-items: center;
}
#surnamediv label {
    margin-left: 10px;
}

#surnamediv {
  display: flex;
  align-items: center;
}

#surnamediv label {
  margin-left: 10px;
}
<div class="styled-input" id="surnamediv">
  <input type="text" id="surName" /><button id="add" class="hidden">Add</button>
  <label>Surname</label>
  <span></span>
</div>
Nandita Sharma
  • 13,287
  • 2
  • 22
  • 35
0

Vertical-align work with flex

<style>
    .styled-input {
    width:100℅;
    display:flex;
    align-items:center;
    }
</style>
Nandita Sharma
  • 13,287
  • 2
  • 22
  • 35
0

#surnamediv {
  display: table;
}

#surnamediv input,
#surnamediv button,
#surnamediv label {
  display: table-cell;
  vertical-align: middle;
}

#surnamediv label {
  padding-left: 10px;
}
<div class="styled-input" id="surnamediv">
  <input type="text" id="surName" /><button id="add" class="hidden">Add</button>
  <label>Surname</label>
  <span></span>
</div>
Nandita Sharma
  • 13,287
  • 2
  • 22
  • 35
Anubhav pun
  • 1,323
  • 2
  • 8
  • 20