html - 语音气泡指针丢失

标签 html css

下面是我写的html代码

<!DOCTYPE html>
    <html>
    <head>
    <style type="text/css">
    #box
    {
        width: 200px;
        height: 250px;
        border-radius: 15px;
        background-color: pink;
        border-color: red;
        border-style: solid;
        display: block;
        -webkit-animation: myrotate 3s infinite; /* animation enabled */
    }
    #box:after /* not working if animation is disabled*/
    { 
       content:"";
       display:block;
       position:absolute;
       bottom:-15px;
       left:20px;
       width:0;
       border-width:15px 25px 0;
       border-style:solid;
       border-color:#13961c transparent;
    }

    @-webkit-keyframes myrotate
    {
    from 
    {
        -webkit-transform:rotate(0deg); /* Safari and Chrome */
    }
    to
    {
        -webkit-transform:rotate(360deg); /* Safari and Chrome */
    }
    }
    </style>
    </head>
    <body>
    <center>
    <div id="box">
     xyz <br/>
     yzx <br>
    </div>
    </center>
    </body>
    </html>

问题是对话气泡指针仅在启用动画 myrotate 时出现。如果它被评论指针消失。我是 css3 和 html5 的新手。请解释。

最佳答案

将此添加到 CSS:

#box {
    position: relative;
}

具有 absolute 位置的元素将仅相对于最近的父级定位,该父级也具有默认位置(static)以外的位置,或者如果没有 parent 有一个非静态位置,然后根据视口(viewport)确定位置。

我怀疑当一个元素被动画化时,浏览器不再将它视为一个静态定位的对象。

关于html - 语音气泡指针丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18298517/

相关文章:

html - CSS 转换出错误

css - 响应式谷歌地图

html - 包装图像位于右侧 100% 高度不重绘

javascript - HTML5 视频的高清控制

html - 新手 : Web application using HTML, CSS、AngularJS、NodeJS、MySQL?

css - 联系表 7 未在固定的父 div 上扩展

html - 指定列中单表行中的两行

javascript - 无法使用 JQuery 模拟点击

html - SVG 半圆 : Why is it rotated?

jquery - 在表单提交中,当我进入下一页时,数据没有出现