IE CSS 对齐问题
我的问题是我有两个需要对齐的下拉框。在 Firefox 中,它工作得很好。基本上,一个用于国家/地区的表格框,然后在其下方是另一个用于州的表格框。在 IE 中,这些框彼此相邻显示。我正在尝试对其进行样式设置,以便第二个表单框出现在第一个表单框的下方。
我的 HTML 代码(我砍掉了一些州,以便更容易阅读):
<div class="label">*Country:</div>
<div class="field">
<asp:DropDownList ID="country" CssClass="country2" runat="server"></asp:DropDownList>
</div>
<div class="label"></div>
<div class="field">
<asp:DropDownList ID="us_states" runat="server" CssClass="us_state_dropdown2">
<asp:ListItem>-Select State-</asp:ListItem>
<asp:ListItem>Alabama</asp:ListItem>
<asp:ListItem>Alaska</asp:ListItem>
<asp:ListItem>Arizona</asp:ListItem>
</asp:DropDownList>
</div>
我的类“label”、“field”、“country2”和“us_state_dropdown2”的 CSS 代码:
.label {width: 195px !important; height: 28px; }
.field {width: auto !important;}
.country2 { width:212px !important;}
.us_state_dropdown2 { width:212px !important;}
有什么想法吗?
My issue is that I have two dropdown boxes that I need to align. In Firefox, it works fine. Basically, one form box for country, and then underneath it, another form box for state. In IE, these boxes show up next to one another. I'm trying to style it so that the second form box appears underneath the first.
My HTML code (I chopped off some states so it'd be easier to read):
<div class="label">*Country:</div>
<div class="field">
<asp:DropDownList ID="country" CssClass="country2" runat="server"></asp:DropDownList>
</div>
<div class="label"></div>
<div class="field">
<asp:DropDownList ID="us_states" runat="server" CssClass="us_state_dropdown2">
<asp:ListItem>-Select State-</asp:ListItem>
<asp:ListItem>Alabama</asp:ListItem>
<asp:ListItem>Alaska</asp:ListItem>
<asp:ListItem>Arizona</asp:ListItem>
</asp:DropDownList>
</div>
My CSS code for classes "label", "field", "country2", and "us_state_dropdown2":
.label {width: 195px !important; height: 28px; }
.field {width: auto !important;}
.country2 { width:212px !important;}
.us_state_dropdown2 { width:212px !important;}
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
clear
来避免元素位于您选择的一侧。阅读 CSS 参考以了解如何使用
clear
。 MDN 参考You can use
clear
to avoid elements from being positioned on the side(s) that you choose.Read the CSS reference to learn how to use
clear
. MDN Reference