我已经看到铬把一个更厚的边界:焦点,但它看起来在我的情况下,我已经使用边界半径也。有办法移除它吗?
当前回答
你可以设定一个大纲:没有;和边界到一个不同的颜色的焦点。
其他回答
要删除默认焦点,请在默认的.css文件中使用以下内容:
:focus {outline:none;}
然后你可以通过元素单独控制焦点边框的颜色,或者在默认的.css中:
:focus {outline:none;border:1px solid red}
显然,用你选择的十六进制代码替换红色。
你也可以保持边界不变,并控制背景颜色(或图像)来突出显示字段:
:focus {outline:none;background-color:red}
:-)
border:0;
outline:none;
box-shadow:none;
这应该能奏效。
你应该可以用
outline: none;
但请记住,这对可用性有潜在的负面影响:很难判断一个元素是否被聚焦,当你使用Tab键遍历表单的所有元素时,这很糟糕——当一个元素被聚焦时,你应该以某种方式反映。
问题是你已经有了一个大纲。Chrome仍然改变了一些东西,这是一个真正的痛苦。我不知道该改变什么:
.search input {
outline: .5em solid black;
width:41%;
background-color:white;
border:none;
font-size:1.4em;
padding: 0 0.5em 0 0.5em;
border-radius:3px;
margin:0;
height:2em;
}
.search input:focus, .search input:hover {
outline: .5em solid black !important;
box-shadow:none;
border-color:transparent;;
}
.search button {
border:none;
outline: .5em solid black;
color:white;
font-size:1.4em;
padding: 0 0.9em 0 0.9em;
border-radius: 3px;
margin:0;
height:2em;
background: -webkit-gradient(linear, left top, left bottom, from(#4EB4F8), to(#4198DE));
background: -webkit-linear-gradient(#4EB4F8, #4198DE);
background: -moz-linear-gradient(top, #4EB4F8, #4198DE);
background: -ms-linear-gradient(#4EB4F8, #4198DE);
background: -o-linear-gradient(#4EB4F8, #4198DE);
background: linear-gradient(#4EB4F8, #4198DE);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#4EB4F8', endColorstr='#4198DE');
zoom: 1;
}
这肯定有用。橙色的轮廓不会再出现了。 通用于所有标签:
*:focus {
outline: none;
}
特定于某些标记,例如:input标记
input:focus{
outline:none;
}
推荐文章
- 使伸缩项目正确浮动
- 卸载Chrome开发工具
- 如何取消最大高度?
- 如何选择在最后一个子元素之前的元素?
- 如何触发自动填充在谷歌Chrome?
- CSS变换,锯齿边缘在铬
- 创建圈div比使用图像更容易的方法?
- 强迫孩子服从父母的弯曲边界在CSS
- 为什么Chrome浏览器不正确地确定页面是在不同的语言,并提供翻译?
- 在CSS中@apply是什么?
- 在网页上用鼠标模拟震颤(例如帕金森病)?
- Bootstrap抛出Uncaught错误:Bootstrap的JavaScript需要jQuery
- 如何改变文本区域的边框颜色:焦点
- 我如何设置背景颜色为文本的宽度,而不是整个元素的宽度,使用CSS?
- 设备像素比到底是什么?