2012-02-15 62 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>