如何去掉button的默认样式

ccqqccqqqq 2011-09-05 09:32:19
要求是:按钮要用我自己的图片,并且按钮的默认样式要完全去掉,四周的边框和背景颜色都不要,该怎么做呀?
以下是我的代码,不知道可以怎么改。希望各位朋友好心相助一番哟。



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>去掉button默认样式</title>
<style>
input,button{ margin:0; padding:0; list-style-type:none;}
.but_c button{ background:none;}
.but_c{
background-image:url(images/icon_ty.gif);
background-repeat:no-repeat;
width:14px;
height:14px;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
}
</style>
</head>

<body>
<div class="test"><input class="but_c" name="" type="button" /></div>
</body>
</html>
...全文
59088 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
MuBeiBei 2011-09-05
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 ccqqccqqqq 的回复:]
我用你6楼贴得代码 已经去掉了button的背景颜色了 仔细看了下 你没有改样式文件 只是在前面加上了一行
<script type="text/javascript"></script>
这个代码而已
并且我把你的<button></button>移到了一个div里面,在IE和FF里看,背景都没有了,那一句<script></script>什么也没有写呀?怎么这么神奇了??
[/Quote]

<script type="text/javascript"></script>呃 这个标签没用你删了吧

我改了你的样式。。。

.but_c{ background:none;}这句~·
ccqqccqqqq 2011-09-05
  • 打赏
  • 举报
回复
我用你6楼贴得代码 已经去掉了button的背景颜色了 仔细看了下 你没有改样式文件 只是在前面加上了一行
<script type="text/javascript"></script>
这个代码而已
并且我把你的<button></button>移到了一个div里面,在IE和FF里看,背景都没有了,那一句<script></script>什么也没有写呀?怎么这么神奇了??
MuBeiBei 2011-09-05
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 ccqqccqqqq 的回复:]
我很不幸的要说 这个图片的需求也很复杂 是一张有很多个小图标组成的GIF图片 用X轴 Y轴坐标来控制显示那张图片的,该怎么办了?
需要显示的图片是一张这样的图:http://www.drame.cn/icon/gif/3750.html
[/Quote]

呃~·要是换我,我只能跟他说改需求了。用div或者别的标签模拟了~·
ccqqccqqqq 2011-09-05
  • 打赏
  • 举报
回复
我很不幸的要说 这个图片的需求也很复杂 是一张有很多个小图标组成的GIF图片 用X轴 Y轴坐标来控制显示那张图片的,该怎么办了?
需要显示的图片是一张这样的图:http://www.drame.cn/icon/gif/3750.html
MuBeiBei 2011-09-05
  • 打赏
  • 举报
回复
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
input,button{ margin:0; padding:0; list-style-type:none;}
.but_c{ background:none;}
.but_c{
background-image:url(images/icon_ty.gif);
background-repeat:no-repeat;
width:14px;
height:14px;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
}

</style>
</head>

<body>
<script type="text/javascript">


</script>
<button class="but_c">click me</button>
</body>
</html>


<button>标签可以
MuBeiBei 2011-09-05
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 ccqqccqqqq 的回复:]
引用 2 楼 mubeibei 的回复:
给img标签加上js onclick事件就行了


需求就是这样的,程序里是这样的,改不了啦!
[/Quote]

那你就用这个标签

<input type="image" src="图片地址" />
ccqqccqqqq 2011-09-05
  • 打赏
  • 举报
回复
要去掉button的默认样式 这是最终目的
ccqqccqqqq 2011-09-05
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 mubeibei 的回复:]
给img标签加上js onclick事件就行了
[/Quote]

需求就是这样的,程序里是这样的,改不了啦!
MuBeiBei 2011-09-05
  • 打赏
  • 举报
回复
给img标签加上js onclick事件就行了
MuBeiBei 2011-09-05
  • 打赏
  • 举报
回复
[Quote=引用楼主 ccqqccqqqq 的回复:]
要求是:按钮要用我自己的图片,并且按钮的默认样式要完全去掉,四周的边框和背景颜色都不要,该怎么做呀?
以下是我的代码,不知道可以怎么改。希望各位朋友好心相助一番哟。



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transi……
[/Quote]


那你直接用img标签就行了啊。。。干嘛还非得用按钮

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧