小编Dan*_*Wit的帖子

添加表单元素时,Chrome加载会在页面加载时触发

Google Chrome版本36.0.1985.143似乎存在错误,或者我在这里遗漏了一些内容.Firefox和Safari似乎按预期工作.

在Vimeo上查看演示视频

当以下html文档中存在表单元素时,Css转换似乎会触发文档加载:

<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" href="style.css" />
    </head>
    <body>
        <div></div>
        <form></form>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

还有一个简单的css文件:style.css

div {
    -webkit-transition:background-color 2s;
       -moz-transition:background-color 2s;
         -o-transition:background-color 2s;
            transition:background-color 2s;
    width: 188px;
    height: 188px;
    background-color: red;
    margin: 0 auto;
}
div:hover {
    background-color: green;
}
Run Code Online (Sandbox Code Playgroud)

<form></form>删除元素将样式表规则内联放置在文档的head部分内时,转换将停止触发,如下所示:

<style>
    div {
        -webkit-transition:background-color 2s;
           -moz-transition:background-color 2s;
             -o-transition:background-color 2s;
                transition:background-color 2s;
        width: 188px;
        height: 188px;
        background-color: red;
    }
</style>
Run Code Online (Sandbox Code Playgroud)

这是一个真正的错误,还是我做错了什么?

PS:我没有启用扩展程序,此行为也会以隐身模式显示.此外,此问题还显示文档是通过文件夹在浏览器中打开还是从实际的apache Web服务器提供.

当我从一个类似的问题重新创建'bug'时:在外部样式表中定义的CSS转换导致页面加载转换似乎是固定的.直到我将过渡属性更改为background-color和ofcourse添加<form></form>元素..

更新:似乎这是Chrome中的一个实际错误.在这里 …

html css forms google-chrome css-transitions

9
推荐指数
2
解决办法
2418
查看次数

标签 统计

css ×1

css-transitions ×1

forms ×1

google-chrome ×1

html ×1