我有一个网格视图,我想将它的标题对齐到左边。它在 chrome 中工作,但在 IE 9 中它们没有向左对齐。
(我粘贴了整个代码,以防某些被包围的 div 负责此行为。)
<div style="height: 300px; overflow: auto">
<asp:GridView ID="myGrid"
AutoGenerateColumns="true"
runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%">
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<EditRowStyle BackColor="#999999" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" HorizontalAlign="Left" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Left"/>
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#E9E7E2" />
<So![enter image description here][1]rtedAscendingHeaderStyle BackColor="#506C8C" />
<SortedDescendingCellStyle BackColor="#FFFDF8" />
<SortedDescendingHeaderStyle BackColor="#6F8DAE" />
</asp:GridView>
</div>
<div style="margin-top: 20px; margin-left: 550px">
<asp:Button ID="btnClose" runat="server" Text="Close" />
</div>
<div>
<asp:Label ID="lblError" runat="server" Text=""></asp:Label>
</div>
</div>
更新1:CSS
#DeltaPlaceHolderMain #ctl00_PlaceHolderMain_myGrid tr:first-child{
background-color:#eb8c00 !important;
color:#FFF !important;
}
#DeltaPlaceHolderMain #ctl00_PlaceHolderMain_myGrid tr:first-child td{
text-align:left;
}
#DeltaPlaceHolderMain #ctl00_PlaceHolderMain_myGrid tr{
color:#404041 !important;
}