CSS按钮样式之button标签与input type=button的区别详解
2016-06-29 23:43
1006 查看
转载文章,原文地址:http://www.cnblogs.com/PeunZhang/archive/2013/04/08/3008520.html
Buttons created with the BUTTON element function just like buttons created with the INPUT element, but they offer richer rendering possibilities: the BUTTON element may have content. For example, a BUTTON element that contains an image functions like and may
resemble an INPUT element whose type is set to “image”, but the BUTTON element type allows content.
The Button Element – W3C
<button> 标签定义一个按钮。
在 button 元素内部,您可以放置内容,比如文本或图像。这是该元素与使用 input 元素创建的按钮之间的不同之处。
<button> 控件 与 <input type="button"> 相比,提供了更为强大的功能和更丰富的内容。<button> 与 </button> 标签之间的所有内容都是按钮的内容,其中包括任何可接受的正文内容,比如文本或多媒体内容。例如,我们可以在按钮中包括一个图像和相关的文本,用它们在按钮中创建一个吸引人的标记图像。
唯一禁止使用的元素是图像映射,因为它对鼠标和键盘敏感的动作会干扰表单按钮的行为。
请始终为按钮规定 type 属性。Internet Explorer 的默认类型是 "button",而其他浏览器中(包括 W3C 规范)的默认值是 "submit"。
释:如果在 HTML 表单中使用 button 元素,不同的浏览器会提交不同的按钮值。请使用 input
元素在 HTML 表单中创建按钮。
Buttons created with the BUTTON element function just like buttons created with the INPUT element, but they offer richer rendering possibilities: the BUTTON element may have content. For example, a BUTTON element that contains an image functions like and may
resemble an INPUT element whose type is set to “image”, but the BUTTON element type allows content.
The Button Element – W3C
定义和用法
<button> 标签定义一个按钮。在 button 元素内部,您可以放置内容,比如文本或图像。这是该元素与使用 input 元素创建的按钮之间的不同之处。
<button> 控件 与 <input type="button"> 相比,提供了更为强大的功能和更丰富的内容。<button> 与 </button> 标签之间的所有内容都是按钮的内容,其中包括任何可接受的正文内容,比如文本或多媒体内容。例如,我们可以在按钮中包括一个图像和相关的文本,用它们在按钮中创建一个吸引人的标记图像。
唯一禁止使用的元素是图像映射,因为它对鼠标和键盘敏感的动作会干扰表单按钮的行为。
请始终为按钮规定 type 属性。Internet Explorer 的默认类型是 "button",而其他浏览器中(包括 W3C 规范)的默认值是 "submit"。
释:如果在 HTML 表单中使用 button 元素,不同的浏览器会提交不同的按钮值。请使用 input
元素在 HTML 表单中创建按钮。
相关文章推荐
- 【CSS3】选择器(表单元素选择器 & 其他)--慕课网【学习总结】
- 学习笔记 css 声明 注释
- CSS3自定义radio
- 老生长谈:CSS实现右侧固定宽度,左侧宽度自适应
- css3 box-sizing属性
- 使用less函数实现不同背景的CSS样式
- CSS3滤镜-Filters
- html首行缩进2字符,可以使用CSS属性中的【text-indent】进行设置。
- HTML 使用CSS 设置透明度Opacity
- 自适应布局,完美解决左右两边固定大小,中间内容适应大小。
- css属性 writing-mode 改变文字书写方向
- 最全的CSS浏览器兼容问题
- css 比较 在同一个水平线上
- CSS中cursor属性给标签加上小手形状
- css3实现字体的颜色渐变
- django 添加 css 等静态文件
- css各种手型集合(css禁止手型)
- CSS Sprite的应用
- Andorid 项目中Dialog的便捷开发,全面的样式选择.
- Div+CSS网页布局中CSS无效的十个常见原因