<p>标记丢弃</p> <div>标记内联块IE 8 </div>

时间:2012-11-24 19:31:42

标签: css layout internet-explorer-8

我有一个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/

1 个答案:

答案 0 :(得分:-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。

内联正确呈现

要证明我的观点here

另请注意,内联块的宽度为problems。如果可能的话使用display:block;和浮动:左(右)。