简体   繁体   English

div在IE中的列表对齐问题

[英]div inside list alignment issue in IE

I have a div inside my li tags, and it displays properly aligned in every browser but IE. 我的li标记中有一个div,它在IE中的所有浏览器中都显示正确对齐。

In IE, it for some reasons decided to put the number way above the div. 在IE中,出于某些原因,它决定将数字置于div之上。 Here are screenies. 这是纱布。

IE: IE浏览器:

Every other browser (Chrome in this case): 其他所有浏览器(在这种情况下为Chrome):

Code: 码:

HTML is generated with this php: HTML是用以下php生成的:

//iterate the new ordered array and echo html
foreach($sort_array as $ID=>$val)
{
//get the title and author
$query = "SELECT ID, TITLE, SUBTITLE FROM $usertable WHERE ID='{$ID}'";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
//echo the data with html formating
echo '
    <li>
        <div class="article">
            <a href="/Articles/' . $row["ID"] . '">
                <h2>' . $row["TITLE"] . '</h2>
                <h3>' . $row["SUBTITLE"] . '</h3>
            </a>
        </div>
    </li>
';      
}

There really is no CSS here that could affect formatting. 这里确实没有CSS会影响格式。 Just font-size, color, and margin-bottom. 只是字体大小,颜色和底边距。

Try adding the display inline property to your elements. 尝试将display inline属性添加到您的元素。

display: inline;

or 要么

display: inline-block;

can you provide your css for the same?That would be helpful! 可以为您提供相同的CSS吗?
and can you specify why have you used div inside li rather than adding style to anchor tag or placing a child ul inside li ? 并且可以指定为什么在li内使用div而不是adding style to anchor tagplacing a child ul inside li吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM