2012-02-15 41 views
0

我一直在用一个非常简单的ASP.Net MVC3项目来实验字符串和RTL的本地化。我有一个观点,看起来像这样:MVC 3和RTL - IE9问题


@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> 

在火狐10 &铬17,这导致与右侧的标签三行文本框的的 - 在右侧的所有排列浏览器。

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

我试过将“dir”移动到body标签和html标签,但我得到了相同的结果。我怎样才能让它在IE9中正确显示?

在此先感谢!

回答

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>