user7548189
user7548189

Reputation: 1016

align="right" disables button

I want a button at the right corner of a div. It works fine normally, but upon adding the align="right" to the html, the button doesn't work anymore (although it does align to the right).

<input id="exitbutton" align="right" style="width:15px" type="image" src="images/#"/>

Why does this happen?

Upvotes: 0

Views: 65

Answers (3)

Anonymous
Anonymous

Reputation: 1990

align property is not for an input field You can use float like this:

input{float:right;}
<input id="exitbutton" style="width:15px" type="image" src="images/#"/>

Upvotes: 0

necilAlbayrak
necilAlbayrak

Reputation: 814

For buttons instead of using inline attributes use text alignment in your css. And avoid giving style with attributes as much as you can.

For form elements you should use float if you are not using flex. But keep it in mind you should clear floats in order to prevent visual errors

Upvotes: 0

Archana
Archana

Reputation: 103

Ideally align="right" is not the property of input tag if you are using HTML5. As you are already applying inline style, you can just apply float:right to align input button to the right.

<input id="exitbutton" style="width:15px; float:right" type="image" src="images/#"/>

Upvotes: 2

Related Questions