I've got the following code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Main.aspx.cs" Inherits="Main" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link rel="stylesheet" type="text/css" href="Styles/TomsStyleSheet.css" />
</head>
<body>
<form id="form1" runat="server">
<div class="centerBlock">
<asp:GridView ID="GridView1" runat="server" CcsClass="center">
</asp:GridView>
</div>
<br />
<div class="centerBlock">
<asp:Label ID="Label1" runat="server" Text="Enter Directory Path: "></asp:Label>
<asp:TextBox ID="TextBox" Width="200px" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="checksumBtn" runat="server" Text="Calculate Checksum" OnClick="CalculateChecksum" />
<br />
<asp:Label ID="errorMsg" runat="server" Text="" CssClass="error"></asp:Label>
</div>
</form>
</body>
</html>
Here's the css:
.centerBlock
{
margin-left:auto;
margin-right:auto;
width:50%;
}
What I'm trying to do is simply center it... horizontally for now but vertically would also be good so it's smack dab in the middle of the page.
I know that it's not a problem of referencing the external style sheet because CssClass="error" on the last line works fine. I've also tried <div style="margin-left:auto;margin-right:auto;">
as according to this suggestion but nothing seems to work. The output is currently left-justified, not centered. I'm using IE 7.