Home > Web Front-end > HTML Tutorial > [CSS] Firefox required input textarea 粉红色边框去除方案 ._html/css_WEB-ITnose

[CSS] Firefox required input textarea 粉红色边框去除方案 ._html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:05:37
Original
1532 people have browsed it

Firefox中,如果一个表单控件具有required属性,那么当这个控件失效时会自动被Firefox加上一圈粉红色的边框,极其难看,无法实现各 个浏览器统一,尤其是当你将这个控件设置了不显示某些边框线的时候,要去除Firefox给有required属性的表单控件添加的边框,只需要添加一句 CSS代码即可。
添加下列代码以后,具有required属性的input和textarea将不再自动添加粉红色边框(其实是盒子阴影)。

         input[required]:invalid, input:focus:invalid, textarea[required]:invalid, textarea:focus:invalid{box-shadow: none;}

 

或者

input:focus{outline:none;}

input:required:invalid{box-shadow: none;}

为了兼容老版本的Firefox,还可以将-moz-box-shadow:none也添加上去。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template