样式HTML表单控件

样式HTML表单控件

问题描述:

我如何样式'重置','按钮'和'文件'输入类型,让我们说图像?样式HTML表单控件

谢谢!

styled.css:

input[@type='button'] 
{ 
    background-image: url(button.png); 
} 

input[@type='reset'] 
{ 
    background-image: url(reset.png); 
} 

input[@type='file'] 
{ 
    background-image: url(file.png); 
} 

HTML

<input type="button" name="buttonname" class="form-button" /> 

CSS

<style type="text/css"> 

.form-button 
{ 
    background-image: url(image.gif); 
} 

</style> 
+0

我做了这样的事情,也没有工作: http://eximi.dreamhosters.com/Hawaii/html/contact_email.php 这里是我的CSS: input.print { \t背景 - image:url(../ assets/images/print_btt.png); \t width:119px; \t height:47px; } input.upload { \t background-image:url(../ assets/images/uf_btt.png); \t width:119px; \t height:47px; } \t input.reset { \t background-image:url(../ assets/images/reset_btt.png); \t width:119px; \t height:47px; } – vlevsha 2010-07-13 01:17:57

+0

HTML: \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t 对不起,我是新来的,不知道如何添加表单注意代码示例。 – vlevsha 2010-07-13 01:21:41

不幸的是你的文件按钮离不开应用a hack设置样式,但其他类型的可样式如下:

<style type="text/css"> 
    input[type=button] { 
    background-image: url(http://static3.grsites.com/archive/textures/blue/blue003.jpg); 
    color: yellow; 
    font-weight: bold; 
    } 

    input[type=reset] { 
    background-image: url(http://static2.grsites.com/archive/textures/red/red003.jpg); 
    color: yellow; 
    font-weight: bold; 
    } 
</style> 
+0

+1:这是最完整的答案。 – NotMe 2010-07-13 00:33:18