MVC 3和RTL - IE9的问题

时间:2012-02-15 19:54:13

标签: asp.net-mvc-3 localization right-to-left

我一直在使用一个非常简单的ASP.Net MVC3项目来试验字符串和RTL的本地化。我有一个看起来像这样的观点:


@model LocalizationExample.Models.HomeModel

@using Microsoft.License.Ux.Partner.LanguageResources.Order;
@{
    ViewBag.Title = "Index";
}

<h2>@OrderResource.PageTitle</h2>
<div dir="rtl">
        @Html.LabelFor(x => x.Field1) @Html.TextBoxFor(x => x.Field1)<br />
        @Html.LabelFor(x => x.Field2) @Html.TextBoxFor(x => x.Field2)<br />
        @Html.LabelFor(x => x.Field3) @Html.TextBoxFor(x => x.Field3)<br />
</div>

在FireFox 10&amp; Chrome 17,这会产生三行TextBox,右侧有标签 - 所有这些都在浏览器的右侧对齐。

在IE9中,前两个文本框的左侧是标签,最后一个文本框的右侧是标签 - 所有文本框都在浏览器的右侧对齐。

我已经尝试将“dir”移动到body标签以及html标签,但是我得到了相同的结果。如何在IE9中正确显示?

提前致谢!

1 个答案:

答案 0 :(得分:0)

如果你将它们嵌入div中,它们似乎正确对齐:

<div dir="rtl">
    <div>
        @Html.LabelFor(x => x.Field1) @Html.TextBoxFor(x => x.Field1)
    </div>
    <div>
        @Html.LabelFor(x => x.Field2) @Html.TextBoxFor(x => x.Field2)
    </div>
    <div>
        @Html.LabelFor(x => x.Field3) @Html.TextBoxFor(x => x.Field3)
    </div>
</div>