0

我有一个包含三个子节点的 div

和另一个

在 chrome 中,所有三个 div 都内联显示,父 div 高度为 25px

在 IE 中,div 标签下拉是因为

下面的标签我有复制可粘贴代码,将为您重现问题

        <style>
        .left{
        float:left;
        }

        .right{
        float:right;
        }

        .grippie{
            width:2px;
            background:black;
            display:inline-block;
            z-index:200;
            height:100%;
            zoom:1;
            z-index:200;
            *display:inline;
        }

        .task P{
        width:90%;
        display:inline;
        }
        .task{
            position:absolute;
            z-index:50;
            text-align:center;
            vertical-align:center;
            overflow:hiddesn;
        }

        /* task rag */
        .task.red{
            background: rgb(242,55,55); /* Old browsers */
            /* IE9 SVG, needs conditional override of 'filter' to 'none' */
            background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIxJSIgc3RvcC1jb2xvcj0iI2YyMzczNyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZjNhM2EiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
            background: -moz-linear-gradient(top,  rgba(242,55,55,1) 1%, rgba(255,58,58,1) 100%); /* FF3.6+ */
            background: -webkit-gradient(linear, left top, left bottom, color-stop(1%,rgba(242,55,55,1)), color-stop(100%,rgba(255,58,58,1))); /* Chrome,Safari4+ */
            background: -webkit-linear-gradient(top,  rgba(242,55,55,1) 1%,rgba(255,58,58,1) 100%); /* Chrome10+,Safari5.1+ */
            background: -o-linear-gradient(top,  rgba(242,55,55,1) 1%,rgba(255,58,58,1) 100%); /* Opera 11.10+ */
            background: -ms-linear-gradient(top,  rgba(242,55,55,1) 1%,rgba(255,58,58,1) 100%); /* IE10+ */
            background: linear-gradient(to bottom,  rgba(242,55,55,1) 1%,rgba(255,58,58,1) 100%); /* W3C */
            filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f23737', endColorstr='#ff3a3a',GradientType=0 ); /* IE6-8 */
        }

        .task.green{
            background: rgb(168,220,24); /* Old browsers */
            /* IE9 SVG, needs conditional override of 'filter' to 'none' */
            background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2E4ZGMxOCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM4ZmMzMDAiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
            background: -moz-linear-gradient(top,  rgba(168,220,24,1) 0%, rgba(143,195,0,1) 100%); /* FF3.6+ */
            background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(168,220,24,1)), color-stop(100%,rgba(143,195,0,1))); /* Chrome,Safari4+ */
            background: -webkit-linear-gradient(top,  rgba(168,220,24,1) 0%,rgba(143,195,0,1) 100%); /* Chrome10+,Safari5.1+ */
            background: -o-linear-gradient(top,  rgba(168,220,24,1) 0%,rgba(143,195,0,1) 100%); /* Opera 11.10+ */
            background: -ms-linear-gradient(top,  rgba(168,220,24,1) 0%,rgba(143,195,0,1) 100%); /* IE10+ */
            background: linear-gradient(to bottom,  rgba(168,220,24,1) 0%,rgba(143,195,0,1) 100%); /* W3C */
            filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a8dc18', endColorstr='#8fc300',GradientType=0 ); /* IE6-8 */

        }

        .task.amber{
            background: rgb(241,218,54); /* Old browsers */
            /* IE9 SVG, needs conditional override of 'filter' to 'none' */
            background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2YxZGEzNiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlZmRjNWYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
            background: -moz-linear-gradient(top,  rgba(241,218,54,1) 0%, rgba(239,220,95,1) 100%); /* FF3.6+ */
            background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(241,218,54,1)), color-stop(100%,rgba(239,220,95,1))); /* Chrome,Safari4+ */
            background: -webkit-linear-gradient(top,  rgba(241,218,54,1) 0%,rgba(239,220,95,1) 100%); /* Chrome10+,Safari5.1+ */
            background: -o-linear-gradient(top,  rgba(241,218,54,1) 0%,rgba(239,220,95,1) 100%); /* Opera 11.10+ */
            background: -ms-linear-gradient(top,  rgba(241,218,54,1) 0%,rgba(239,220,95,1) 100%); /* IE10+ */
            background: linear-gradient(to bottom,  rgba(241,218,54,1) 0%,rgba(239,220,95,1) 100%); /* W3C */
            filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f1da36', endColorstr='#efdc5f',GradientType=0 ); /* IE6-8 */
        }

        </style>

<div id="AEW1T3Task" class="task amber" style="height: 25px; width: 103px; top: 101px; left: 312px;">
    <p>Style IT<p/>
    <div id="AEW1T3Taskgrippie" class="grippie right"></div>
    <div class="grippie left"></div>
</div>

编辑:

这是上面代码的 jsFiddle:http: //jsfiddle.net/7R2uy/

4

1 回答 1

-1

这将解决您的问题,将此代码放在 html 文件的顶部:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

由于 DOCTYPE div-s 与 p 内联正确呈现。

为了证明我的观点,请看这里

还要注意 inline-block 有一些宽度问题。如果可能的话,使用 display: block; 和浮动:左(右)。

于 2012-11-24T19:42:37.163 回答