Posted 11 years ago
·
Author
Understanding the basic syntax of the <button> tag
The basic syntax of the new <button> tag is like any other containment tag:
<button>.....</button>
<button>Some text here</button>
Unlike the <input type="button"> tag, the new <button> tag does not require the company of the <form> tag surrounding it in order to display.
Now, at first glance, the <button> tag looks like a normal form button, but as mentioned, its a little more than that.
Example Buttons
Back Button
Forward Button
Home Button
Reload Page Button
Close Button
Controlling the width/height of the button
By default, the dimensions of the button is automatically set to the dimensions required to accommodate the content inside, such as an image. There will often be times when you want to manually control this dimension to fit your design. By using another CSS declaration, you can. To control the width/height of the button, use the following style declaration:
Opening a new window with the specified document:
The basic syntax of the new <button> tag is like any other containment tag:
<button>.....</button>
<button>Some text here</button>
Unlike the <input type="button"> tag, the new <button> tag does not require the company of the <form> tag surrounding it in order to display.
Now, at first glance, the <button> tag looks like a normal form button, but as mentioned, its a little more than that.
Example Buttons
Back Button
Forward Button
Home Button
<button style="width:65;height:65" onClick="window.location='http://www.SOMEWEBSITE.com'"><b>Home</b></button>
Reload Page Button
Close Button
<button style="font: bold 14px Arial">Big text</button>
<button style="color: red"><b>Save the environment!</b></button>
<button><img src="kitty.gif" /></button>
<button>
<table border="1" width="100%">
<tr>
<td width="19%"><img src="construct.gif" /></td>
<td width="81%">Under Construction</td>
</tr>
</table>
</button>
Controlling the width/height of the button
By default, the dimensions of the button is automatically set to the dimensions required to accommodate the content inside, such as an image. There will often be times when you want to manually control this dimension to fit your design. By using another CSS declaration, you can. To control the width/height of the button, use the following style declaration:
Opening a new window with the specified document: