html - 为什么 Canvas 内的 <img> 标签在 Firebug 中变灰?

标签 html css

canvas 元素中的 img 标签在 firebug 中是灰色的。这主要是由于样式值不正确,例如 display: noneopacity: 0heightwidth等于零。

但据我所见,在我的场景中并非如此。我已经通过多次检查来验证这一点,但无法弄清楚为什么它被隐藏了。

<!doctype html>
<html>
    <head>
        <meta charset="utf-8">        
        <style>
* {
    margin : 0;
}

html, body {
    height : 900px;
}

#wrapper {
    height : 80%;
    margin : 1% auto;
    width  : 960px;

    -webkit-border-radius : 12px;
       -moz-border-radius : 12px;  
            border-radius : 12px;       

    -webkit-box-shadow : 0 0 10px #CCC; 
      -moz-box-shadow  : 0 0 10px #CCC;
           box-shadow  : 0 0 10px #CCC; 

    -webkit-background-clip : padding-box;
       -moz-background-clip : padding;
            background-clip : padding-box;  
}

#wrapper > * {
    opacity : 0.6;
}

#wrapper * {
    opacity : 1.0;
}

#wrapper nav {
    height     : 20%;
    text-align : center;    
}

#wrapper nav ul {
    list-style : none;
    height     : 90%;
}

#wrapper nav ul li {
    display : inline-block;
    height  : 100%;
    padding : 0 5% 0 0;
    width   : 10%;
}

.link {
    border  : 1px solid #777;
    display : block;
    float   : left;
    height  : 100%;
    margin  : 5% 10% 10% 5%;
    width   : 100%;

    background-color :                              transparent;
    background-image : -webkit-linear-gradient(top, transparent, transparent);
    background-image :    -moz-linear-gradient(top, transparent, transparent);
    background-image :     -ms-linear-gradient(top, transparent, transparent);
    background-image :      -o-linear-gradient(top, transparent, transparent);
    background-image :         linear-gradient(top, transparent, transparent);
}

.link:hover {
    border : 1px solid #000;

    -webkit-border-radius : 12px;
       -moz-border-radius : 12px; 
            border-radius : 12px;   

    -webkit-box-shadow : 0 0 10px black;
       -moz-box-shadow : 0 0 10px black;
            box-shadow : 0 0 10px black;    

    -webkit-background-clip : padding-box;  
       -moz-background-clip : padding;
            background-clip : padding-box;

    -webkit-transition : all 0.3s ease-out;
       -moz-transition : all 0.3s ease-out;
        -ms-transition : all 0.3s ease-out; 
         -o-transition : all 0.3s ease-out;
            transition : all 0.3s ease-out; 
}
        </style>
    </head>
    <body>
        <div id="wrapper">
            <nav>
                <ul>
                    <li>
                        <a class="link" href="./?action=foo">
                            <canvas>
                                <img alt="foo" src="images/foo.png">
                            </canvas>
                        </a>
                    </li>
                    <!-- ... -->
                </ul>
            </nav>
        </div>
    </body>
</html>

最佳答案

除了浏览器不支持 canvas 之外,canvas 元素中的所有内容都是隐藏的!!

Look at the canvas tutorial for information about how to create an image in canvas

noscript 标签做同样的事情;)

关于html - 为什么 Canvas 内的 <img> 标签在 Firebug 中变灰?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8559032/

相关文章:

html - 视频时间轴上的标记

html - 带有图标的 Bootstrap 图像悬停叠加

javascript - event.preventDefault 在 Firefox 中不起作用

javascript - 选择下拉菜单并单击单选按钮时显示 div

html - 需要帮助将元素垂直居中放置在列中的剩余空间中

jquery - 使用 JQuery 触发 HTML 5 颜色选择器的点击

css - 使用 SX 属性创建动画 - MUI v5

php - Wordpress - 条件与父术语

javascript - 带有粘性表列的表的粘性标题

css - 如何为 SVG 文本设置动画但不是线性的?