matthurne
12-15-2002, 05:43 PM
Ok, here's the deal. I'm no fool but this isn't working out for me. I have a simple XHTML 1.1 page...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Tax Project</title>
<style type="text/css">
body {
text-align: center
}
.Heading {
font-size: 20pt;
font-family: Arial;
font-weight: bold
}
table {
position: absolute;
left: 50%;
border-color: #000066;
border-width: 10px;
border-style: dotted
}
td {
vertical-align: middle;
text-align: center
}
</style>
<script type="text/javascript">
<!--
function calcTax(subtotal)
{
return (Math.round((parseFloat(subtotal) * 1.06) * 100)) / 100;
}
// -->
</script>
</head>
<body>
<p class="Heading">
Tax Project
</p>
<table>
<tbody>
<tr>
<td>
Enter the subtotal cost of the product and then press the TAB key...
<br />
<label for="thePrice">Subtotal: </label>
<input type="text" size="5" id="thePrice" onblur="document.getElementById('theTotal').value=calcTax(document.getElementById('thePrice').value);" />
<br />
<label for="theTotal">Total Cost: </label>
<input type="text" size="5" id="theTotal" />
</td>
</tr>
</tbody>
</table>
<p>
© 2002 Matthew Hurne
</p>
</body>
</html>
I simply want the table in this page to be in the center of the page. You know, what "align='center'" would have done in earlier HTML versions. I've tried posting on other forums and nobody has anything useful. You'd think center aligning something would be easy enough, right?
I figured "text-align: center" on the entire body would cause my table to be center aligned. Wrong. Everything else is centered, but not the table.
I don't want to use absolute positioning. Too elaborate for a simple page! Seems silly for my uses.
Any help would be appreciated!
P.S. I have attached the file as well, as a txt file since that is a valid file extension to attach...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Tax Project</title>
<style type="text/css">
body {
text-align: center
}
.Heading {
font-size: 20pt;
font-family: Arial;
font-weight: bold
}
table {
position: absolute;
left: 50%;
border-color: #000066;
border-width: 10px;
border-style: dotted
}
td {
vertical-align: middle;
text-align: center
}
</style>
<script type="text/javascript">
<!--
function calcTax(subtotal)
{
return (Math.round((parseFloat(subtotal) * 1.06) * 100)) / 100;
}
// -->
</script>
</head>
<body>
<p class="Heading">
Tax Project
</p>
<table>
<tbody>
<tr>
<td>
Enter the subtotal cost of the product and then press the TAB key...
<br />
<label for="thePrice">Subtotal: </label>
<input type="text" size="5" id="thePrice" onblur="document.getElementById('theTotal').value=calcTax(document.getElementById('thePrice').value);" />
<br />
<label for="theTotal">Total Cost: </label>
<input type="text" size="5" id="theTotal" />
</td>
</tr>
</tbody>
</table>
<p>
© 2002 Matthew Hurne
</p>
</body>
</html>
I simply want the table in this page to be in the center of the page. You know, what "align='center'" would have done in earlier HTML versions. I've tried posting on other forums and nobody has anything useful. You'd think center aligning something would be easy enough, right?
I figured "text-align: center" on the entire body would cause my table to be center aligned. Wrong. Everything else is centered, but not the table.
I don't want to use absolute positioning. Too elaborate for a simple page! Seems silly for my uses.
Any help would be appreciated!
P.S. I have attached the file as well, as a txt file since that is a valid file extension to attach...