Style DL as a table. Oh no, IE7 floats DD

左心房为你撑大大i 提交于 2019-12-13 16:10:09

问题


I have a defined list. Works great with everything but IE7 (don't care about IE6) in which the DD column remains on the top line. Can anyone tell me why and how to fix? Thanks

<!DOCTYPE html>
<html>
    <head>
        <title>DL Lists</title>
        <style>
            dt,dd { float:left;}
            dt { clear:both;}
        </style>
    </head>
    <body>
        <dl>
            <dt>title for column 2</dt><dd>column 2 value</dd>
            <dt>title for column 2</dt><dd>&nbsp;</dd>
            <dt>title for column 2</dt><dd>column 2 value</dd>
            <dt>title for column 2</dt><dd>column 2 value</dd>
        </dl>
    </body>
</html>

回答1:


<!DOCTYPE html>
<html>
    <head>
        <title>DL Lists</title>
        <style>
            dt { float:left; clear:left; width: 200px;}            
        </style>
    </head>
    <body>
        <dl>
            <dt>title for column 2</dt><dd>column 2 value</dd>
            <dt>title for column 2</dt><dd>&nbsp;</dd>
            <dt>longer title for column 2</dt><dd>column 2 value</dd>
            <dt>title for column 2</dt><dd>longer column 2 value</dd>
        </dl>
    </body>
</html>


来源:https://stackoverflow.com/questions/15702638/style-dl-as-a-table-oh-no-ie7-floats-dd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!