在css中,主要通过border属性的设置,实现去掉边框。以代码编辑器:zend studio 10.0为例,可参考以下步骤去掉button(按钮)的边框:
1、新建一个html文件,命名为test.html,用于讲解。
2、在test.html文件内,使用button标签创建一个按钮,用于测试。
3、在test.html文件内,给button按钮添加一个id属性,用于样式的设置。
4、在test.html文件内,编写<style type="text/css"></style>标签,页面的css样式将写在该标签内。
5、在css标签中,通过id设置button的样式,定义其背景颜色为蓝色,文字颜色为白色,最后,将border属性设置为none,实现去掉button的边框。
6、在浏览器打开test.html文件,查看实现的效果。
我想你要的是改变边框线颜色的效果吧,我做了一下,兼容IE6 7 8 火狐;直接用border是用很多问题的,比如你说的“颜色改了可是中间有个边界”以及不兼容等,所以 以下例子你看看是不是你要的效果
<!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/htmlcharset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
body,div,input{margin:0padding:0}
.cheBor{ float:leftmargin:0 3pxborder: #FF0000 1px solidwidth:11pxheight:11pxoverflow:hidden}
.cheBor1{margin:-1px*margin:-5px}
</style>
</head>
<body>
<div class="cheBor"><input name="" type="checkbox" value="" class="cheBor1" /></div>
<div class="cheBor"><input name="" type="checkbox" value="" class="cheBor1" /></div>
<div class="cheBor"><input name="" type="checkbox" value="" class="cheBor1" /></div>
<div class="cheBor"><input name="" type="checkbox" value="" class="cheBor1" /></div>
</body>
</html>
空白的产生一般由父容器的padding(内边距)和子元素的margin(外边距)产生,所以将以上两者的值设为0就能清除空白。看你的截图,猜想你应该是用了ol有序列表,可以尝试这样调整:
ol {margin:0 padding:0}