内联UL元素在IE7中不起作用

时间:2009-09-21 21:12:43

标签: css internet-explorer inline html-lists

下面是我正在研究的整个测试页面(我意识到它仍然是丑陋和杂乱的)。我的问题是ul class =“dropdown”。我打算把它作为SELECT的替代品,所以我可以设计它(再次,还没有完成)。但是,我似乎无法将它定位在我想要的位置。如果你在FF3.5中查看这个页面,那就是我希望它被定位的方式。但是,在IE7中,它正在将UL推向下一行,而不是与标签对接。我尝试了很多我在网上找到的黑客,似乎没有任何帮助。我在这里缺少什么?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
        <title>Radix Test Page</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <style type="text/css">
            body{
                margin:0;
                padding:1em;    
                font-family:arial,sans-serif;
            }

            .user-form li
            {
                background: #fff none no-repeat bottom right;
                border: 1px solid #000;
                margin: 0;
                padding-right: 35px;
                text-align: right;
            }

            .user-form li label
            {
                background: #fff; 
                border: 1px solid #333;
                display: -moz-inline-stack;    /* Support below FF3 */
                display: inline-block;        /* Used only to set width */
                padding: 1px 0;
                width: 10em;
            }

            .dropdown
            {
                border: 1px solid #f00;
                width: 20em;
                padding: 0;
                margin: 0;
                display:inline-block;
            }

            .dropdown , 
            .dropdown ul
            {
                list-style-type:none;
            }

            .dropdown li
            {
                text-align: left;
            }
        </style>
    </head>
    <body>
        <form id="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2" class="edit-on" action="/service/testclass.php">
            <fieldset>
                <input id="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:id" name="id" value="a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2" type="hidden"/>
                <ul class="user-form">
                    <li class="valid">
                        <label for="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:name_prefix">Prefix:</label>
                        <input value="Ms." id="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:name_prefix" name="name_prefix" type="hidden"/>
                        <ul class="dropdown">
                            <li>
                                <a href="#" class="trigger">Miss</a>
                            </li>
                            <li class="dropcontainer">
                                <ul class="dropdownhidden">
                                    <li>
                                        <a href="#">&nbsp;</a>
                                    </li>
                                    <li>
                                        <a href="#">Mister</a>
                                    </li>
                                    <li>
                                        <a href="#">Misses</a>
                                    </li>
                                    <li>
                                        <a href="#">Miss</a>
                                    </li>
                                    <li>
                                        <a href="#">Doctor</a>
                                    </li>
                                    <li>
                                        <a href="#">This is just a little test to see exactly how long this silly thing will make my option</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                        <input name="name_prefix_value" value="Mr." type="hidden"/>
                    </li>
                    <li class="valid">
                        <label for="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:last_name">Customer Last Name:</label>
                        <input id="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:last_name" name="last_name" value="Jones" type="text"/>
                    </li>
                    <li class="valid">
                        <label for="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:first_name">My First Name:</label>
                        <input id="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:first_name" name="first_name" value="George" type="text"/>
                    </li>
                    <li class="valid">
                        <label for="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:middle_name">Middle Name:</label>
                        <input id="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:middle_name" name="middle_name" type="text"/>
                    </li>
                    <li class="valid">
                        <label for="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:name_suffix">Suffix:</label>
                        <select id="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:name_suffix" name="name_suffix">
                            <option value="0"/>
                            <option value="Jr.">Junior</option>
                            <option value="Sr.">Senior</option>
                        </select>
                        <input name="name_suffix_value" type="hidden"/>
                    </li>
                    <li class="invalid">
                        <label for="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:birth_date">Date of Birth:</label>
                        <input id="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:birth_date" name="birth_date" type="text"/>
                    </li>
                    <li class="warning">
                        <label for="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:gender">Gender:</label>
                        <select id="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:gender" name="gender">
                            <option value="0"/>
                            <option value="U">Unknown</option>
                            <option value="M">Male</option>
                            <option value="F">Female</option>
                        </select>
                        <input name="gender_value" type="hidden"/>
                    </li>
                </ul>
                <div class="form-actionbar">
                    <input name="form-edit" value="Edit" class="button-view" type="submit" disabled="disabled"/>
                    <input name="form-draft" value="Draft" class="button-edit" type="submit"/>
                    <input name="form-submit" value="Submit" class="button-edit" type="submit"/>
                    <input name="form-cancel" value="CancelMe" class="button-edit" type="submit"/>
                    <input name="form-suspend" value="Suspend" class="button" type="submit"/>
                </div>
            </fieldset>
        </form>
    </body>
</html>

3 个答案:

答案 0 :(得分:0)

您是否尝试过在UL之后移动隐藏的输入字段?

答案 1 :(得分:0)

您可以尝试将<label> and in two separate放在表格中。像这样:

............
    <fieldset>
            <input id="Hidden1" name="id" value="a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2"
                type="hidden" />
            <ul class="user-form">
                <li class="valid">
                    <table cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td style="vertical-align:bottom">
                                <label for="person.a82c3a5d-5f5e-5dbb-ae3a-14a093157dc2:name_prefix">
                                    Prefix:</label>
                            </td>
                            <td>
                                <ul class="dropdown">
                                    <li><a href="#" class="trigger">Miss</a> </li>
                                    <li class="dropcontainer">
                                        <ul class="dropdownhidden">
                                            <li><a href="#"></a></li>
                                            <li><a href="#">Mister</a> </li>
                                            <li><a href="#">Misses</a> </li>
                                            <li><a href="#">Miss</a> </li>
                                            <li><a href="#">Doctor</a> </li>
                                            <li><a href="#">This is just a little test to see exactly how long this silly thing
                                                will make my option</a></li>
                                        </ul>
                                    </li>
                                </ul>
                            </td>
                        </tr>
                    </table>
                    <input value="Ms." id="Hidden2" name="name_prefix"
                        type="hidden" />
                    <input name="name_prefix_value" value="Mr." type="hidden" />
                </li>
............

答案 2 :(得分:0)

使用IE7,您必须在后续规则中跟随display: inline-block; css规则中带有display: inline;的任何元素,通常位于“ie lt 7”样式表中。那可能是这里发生了什么?