Hommer Smith
Hommer Smith

Reputation: 27852

Append submit button to input

I have an input of type button that is used to validate a form an input of type text.

I have seen that, for example, bootstrap lets you append some values to input. I am wondering how would I do append this input of type button into my input of type text.

I have added a screenshot of how I am thinking of it to be, but I am not sure which CSS strategy I would choose.

Thanks

enter image description here

Upvotes: 1

Views: 3254

Answers (1)

Mr. Alien
Mr. Alien

Reputation: 157314

It is nothing but a submit button with a text field

Demo

HTML

<div class="wrap">
   <input type="text" />
   <input type="button" value="Demo" />
</div>

CSS

.wrap {
    display: inline-block;
    position: relative;
}

input[type=text] {
    padding: 10px;
    width: 300px;
    padding-right: 60px;
}

input[type=button] {
    padding: 2px;
    position: absolute;
    right: 5px;
    top: 5px;
}

Upvotes: 2

Related Questions