因为工作一年多以来,做的工作基本都是和webkit
系列打交道。
先是做m站,后来做了两个app
内嵌的hybrid
项目,从来只考虑webkit
前缀和相关的伪类。
最近四个多月开始做内部的管理系统,写写样式,偶尔做个calendar
、tree
之类的组件,所有的基本只考虑新版Chrome
。从来没考虑别的问题。
最近在帮人解决firefox
下的一些兼容问题。QA
妹纸提交了一堆“bug”
。Bug
列表让人看了头疼,还有点心虚。囧。
按部就班,先打开控制台。一番研究,发现不少“bug”
都是样式的问题,并不是脚本兼容做得不好。
下面就细数下最近发现的一些bug
,算是做个备忘。以后还是得注意啊。
一)还在用 background-position-x 吗
以前看一些CSS规范,反复强调不要使用background-position-x
之类的属性。
如百度FEX
就指出:
4.6 2D 位置
[强制] 必须同时给出水平和垂直方向的位置。<span class="hljs-comment" style="color: #999988; font-style: italic;">/* good */</span> <span class="hljs-tag" style="color: #000080; font-weight: normal;">body</span> <span class="hljs-rules">{ <span class="hljs-rule"><span class="hljs-attribute" style="color: #008080;">background-position</span>:<span class="hljs-value"> center top</span></span>; <span class="hljs-comment" style="color: #999988; font-style: italic;">/* 50% 0% */</span> <span class="hljs-rule">}</span></span> <span class="hljs-comment" style="color: #999988; font-style: italic;">/* bad */</span> <span class="hljs-tag" style="color: #000080; font-weight: normal;">body</span> <span class="hljs-rules">{ <span class="hljs-rule"><span class="hljs-attribute" style="color: #008080;">background-position</span>:<span class="hljs-value"> top</span></span>; <span class="hljs-comment" style="color: #999988; font-style: italic;">/* 50% 0% */</span> <span class="hljs-rule">}</span></span>一直以来恪守这个规则,但并没有深究原因。
直到这次,真正遇到了问题。才在控制台上发现,原来background-position-x
在Firefox
下面是**无效**
的!!!
二)咦,为嘛还没开始输入文本框就验证变红了?
第二个问题。
项目有个修改密码的表单。验证不通过的话,输入框会加上红色的边框。
然后QA
妹纸在描述中说的是:
firefox
浏览器中,修改密码页面,输入框中不输入任何字符,输入框颜色也是红的
我还以为又是哪里的js写得不对呢。找了半天,还是决定从样式入手。
Firefox
的调试工具面板里,似乎只列出了样式表中的样式。浏览器默认样式的值,很难找到。我只能一点点试验。
最后发现,input
输入框好像都带了个required
属性。这是HTML5
里表示表单元素必填的属性。莫非问题出在这里?试着删除了这个属性,果然解决了。
其实,这红色的边框,并不是border
,而是box-shadow
啊。
最后得到解决方案是加上这段CSS
:
<span class="hljs-tag" style="color: #000080; font-weight: normal;">input</span><span class="hljs-pseudo">:required</span><span class="hljs-pseudo">:invalid</span> <span class="hljs-rules">{ <span class="hljs-rule"><span class="hljs-attribute" style="color: #008080;">box-shadow</span>:<span class="hljs-value"> none</span></span>; <span class="hljs-rule">}</span></span>
三)我擦,明明写了 outline: 0
可是然并卵啊
QA
妹纸还反映,登录、注册等视图的各种按钮,在Firefox
怎么点击之后,会出现黑色的边框啊?
啥?难道写代码的前端哥们儿不知道在:active
、:focus
等状态下写个outline:0
啊?这不科学。
于是又开始了神奇的探(gu)索(ge)之旅。
这次得到的答案是,这黑色的细线还真不是outline
。这是一个奇怪的伪类,::-moz-focus-inner
。简直哭死在键盘上。
于是,下面这段代码解决问题:
<span class="hljs-tag" style="color: #000080; font-weight: normal;">button</span><span class="hljs-pseudo">::-moz-focus-inner</span>, <span class="hljs-tag" style="color: #000080; font-weight: normal;">input</span><span class="hljs-attr_selector">[type="reset"]</span><span class="hljs-pseudo">::-moz-focus-inner</span>, <span class="hljs-tag" style="color: #000080; font-weight: normal;">input</span><span class="hljs-attr_selector">[type="button"]</span><span class="hljs-pseudo">::-moz-focus-inner</span>, <span class="hljs-tag" style="color: #000080; font-weight: normal;">input</span><span class="hljs-attr_selector">[type="submit"]</span><span class="hljs-pseudo">::-moz-focus-inner</span>, <span class="hljs-tag" style="color: #000080; font-weight: normal;">input</span><span class="hljs-attr_selector">[type="file"]</span> > <span class="hljs-tag" style="color: #000080; font-weight: normal;">input</span><span class="hljs-attr_selector">[type="button"]</span><span class="hljs-pseudo">::-moz-focus-inner</span> <span class="hljs-rules">{ <span class="hljs-rule"><span class="hljs-attribute" style="color: #008080;">border-color</span>:<span class="hljs-value"> transparent</span></span>; <span class="hljs-rule">}</span></span>
最后,还有些其他的
-
还有什么
clipboardData
截图粘贴的问题,见上一篇专栏【在网页中获取截图数据】Chrome和Firefox下的实战经验; -
还有些东西,当时写到注释中了,忘了。。
TO BE CONTINUED…

WebDevelovermentReliesonHtml,CSS和JavaScript:1)HTMLStructuresContent,2)CSSStyleSIT和3)JavaScriptAddSstractivity,形成thebasisofmodernWebemodernWebExexperiences。

HTML的作用是通过标签和属性定义网页的结构和内容。1.HTML通过到、等标签组织内容,使其易于阅读和理解。2.使用语义化标签如、等增强可访问性和SEO。3.优化HTML代码可以提高网页加载速度和用户体验。

htmlisaspecifictypefodyfocusedonstructuringwebcontent,而“代码” badlyLyCludEslanguagesLikeLikejavascriptandPytyPythonForFunctionality.1)htmldefineswebpagertuctureduseTags.2)“代码”代码“ code” code code code codeSpassSesseseseseseseseAwiderRangeLangeLangeforLageforLogageforLogicIctInterract

HTML、CSS和JavaScript是Web开发的三大支柱。1.HTML定义网页结构,使用标签如、等。2.CSS控制网页样式,使用选择器和属性如color、font-size等。3.JavaScript实现动态效果和交互,通过事件监听和DOM操作。

HTML定义网页结构,CSS负责样式和布局,JavaScript赋予动态交互。三者在网页开发中各司其职,共同构建丰富多彩的网站。

HTML适合初学者学习,因为它简单易学且能快速看到成果。1)HTML的学习曲线平缓,易于上手。2)只需掌握基本标签即可开始创建网页。3)灵活性高,可与CSS和JavaScript结合使用。4)丰富的学习资源和现代工具支持学习过程。

AnexampleOfAstartingTaginHtmlis,beginSaparagraph.startingTagSareEssentialInhtmlastheyInitiateEllements,defiteTheeTheErtypes,andarecrucialforsstructuringwebpages wepages webpages andConstructingthedom。

如何设计菜单中的虚线分割效果?在设计菜单时,菜名和价格的左右对齐通常不难实现,但中间的虚线或点如何...


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

Atom编辑器mac版下载
最流行的的开源编辑器

螳螂BT
Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

SecLists
SecLists是最终安全测试人员的伙伴。它是一个包含各种类型列表的集合,这些列表在安全评估过程中经常使用,都在一个地方。SecLists通过方便地提供安全测试人员可能需要的所有列表,帮助提高安全测试的效率和生产力。列表类型包括用户名、密码、URL、模糊测试有效载荷、敏感数据模式、Web shell等等。测试人员只需将此存储库拉到新的测试机上,他就可以访问到所需的每种类型的列表。