|
|
| Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate. |
|
|||||||
| TouchArcade.com - iPhone Game Reviews and News |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
macrumors 6502a
Join Date: Apr 2005
Location: Monterrey, México
|
CSS is evil
Maybe it's the fact that I didn't even read anything about it before using it, but I'm really hating CSS right now. I'm trying to create the table that's on the attached picture. For some reason, I can align that table to the address bar on Firefox but not on IE6 (ie. there's a small gap between the address bar and the table), and I can align it on IE6 but not on Firefox, but never both
This is the css bit: Code:
div.CenteredMenu
{
text-align: center;
}
div.CenteredMenu table
{
margin-top: 0px;
margin-left: auto;
margin-right: auto;
text-align: left;
}
.Menu
{
display: block;
font-weight: bold;
vertical-align: sub;
width: 600px;
color: white;
font-family: Verdana;
height: 25px;
background-color: dimgray;
text-align: center;
}
Code:
<div class="CenteredMenu"> <table class="Menu"> <tr> <td>Some text</td> </tr> </table> </div>
__________________
"He who will not reason is a bigot; he who cannot is a fool; and he who dares not is a slave."
|
|
|
|
|
|
#2 |
|
macrumors 68040
|
I haven't mastered CSS yet, but I think its your margin tags. IE6 interprets margins differently in CSS that other browsers (why M$, WHY?). Google IE6 CSS margin fix.
Otherwise wait for the CSS masters to arrive here....shouldn't be long.
__________________
Spare me my life. MBP 2.2 glossy, Alu Macbook 2.4, iMac G5, iPhone3GS 32gb white, iPodz |
|
|
|
|
|
#3 |
|
macrumors 6502a
|
Did you set the body padding to zero as well? Usually the first line of CSS code I use is this:
Code:
*{
margin: 0px;
padding: 0px;
border: 0px;
}
|
|
|
|
|
|
#4 |
|
Thread Starter
macrumors 6502a
Join Date: Apr 2005
Location: Monterrey, México
|
Thanks guys, I tried both of your suggestions, but still no luck. I found another solution though, I'll just kill myself, that'll make the pain go away, right?
heheh I guess I'll just focus on the rest of the page for now, I'm wasting too much time on this.
__________________
"He who will not reason is a bigot; he who cannot is a fool; and he who dares not is a slave."
|
|
|
|
|
|
#5 |
|
macrumors regular
|
I've tried using CSS but because of the way IE's acts retarted with it, I don't use it anymore. Sticking with tables (probably indefinently) until IE gets their act together.
|
|
|
|
|
|
#6 |
|
macrumors 601
Join Date: Aug 2003
|
Floyde, I tried exactly (I think?) the code you posted with IE 6.0.2900.2180 and it displays exactly the same as in Safari, Camino and Mac IE5. For reference, I'm including exactly the page I am loading. Is it possible that something else in your code is causing the weird table formatting?
Code:
<html>
<head>
<style type="text/css">
<!--
div.CenteredMenu
{
text-align: center;
}
div.CenteredMenu table
{
margin-top: 0px;
margin-left: auto;
margin-right: auto;
text-align: left;
}
.Menu
{
display: block;
font-weight: bold;
vertical-align: sub;
width: 600px;
color: white;
font-family: Verdana;
height: 25px;
background-color: dimgray;
text-align: center;
}
-->
</style>
</head>
<body>
<div class="CenteredMenu">
<table class="Menu">
<tr>
<td>Some text</td>
</tr>
</table>
</div>
</body>
</html>
Last edited by iMeowbot : Jan 24, 2006 at 01:37 AM. |
|
|
|
|
|
#7 | |
|
Thread Starter
macrumors 6502a
Join Date: Apr 2005
Location: Monterrey, México
|
Quote:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>Empresas - Gasinbursa.net</title> <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"> <meta content="C#" name="CODE_LANGUAGE"> <meta content="JavaScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> <LINK href="css/Style.css" type="text/css" rel="stylesheet"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <uc1:Menu id="Menu1" runat="server"></uc1:Menu> Code:
<div class="CenteredMenu"> <table class="Menu"> <tr> <td>Some text</td> </tr> </table> </div> Code:
body
{
margin: 0px;
}
__________________
"He who will not reason is a bigot; he who cannot is a fool; and he who dares not is a slave."
|
|
|
|
|
|
|
#8 |
|
macrumors 68020
|
The fact that you are using "auto" as a property could be what makes different reuslts in the each browser.
Set all to zero. |
|
|
|
|
|
#9 | |
|
Thread Starter
macrumors 6502a
Join Date: Apr 2005
Location: Monterrey, México
|
Quote:
__________________
"He who will not reason is a bigot; he who cannot is a fool; and he who dares not is a slave."
|
|
|
|
|
|
|
#10 | |
|
Thread Starter
macrumors 6502a
Join Date: Apr 2005
Location: Monterrey, México
|
Quote:
__________________
"He who will not reason is a bigot; he who cannot is a fool; and he who dares not is a slave."
|
|
|
|
|
|
|
#11 | ||
|
macrumors 68000
|
Quote:
Quote:
Code:
div.CenteredMenu {margin: 0 auto;
text-align: center;
width: 100%}
Code:
<style type="text/css">
<!--
code {code}
-->
</style>
-Chase |
||
|
|
|
|
|
#12 | |
|
macrumors 601
Join Date: Aug 2003
|
Quote:
|
|
|
|
|
|
|
#13 |
|
Thread Starter
macrumors 6502a
Join Date: Apr 2005
Location: Monterrey, México
|
Well after much random fiddling I finally came up with a cross-browser, auto-centering, top-aligned, wonder table. And it only took me a day to figure it out!
I don't even know what I did to fix it, but if you ever need one, here it is:Code:
div.CenteredMenu
{
text-align: center;
}
div.CenteredMenu table
{
margin: 0 auto;
text-align: left;
}
.Menu
{
padding-right: 0px;
padding-left: 0px;
font-weight: bold;
font-size: smaller;
padding-bottom: 0px;
margin: 0px;
width: 600px;
color: white;
padding-top: 0px;
font-family: Verdana;
top: 0px;
height: 25px;
background-color: dimgray;
}
__________________
"He who will not reason is a bigot; he who cannot is a fool; and he who dares not is a slave."
|
|
|
|
|
|
#14 |
|
Demi-God (Moderator)
Join Date: Jun 2000
|
Isn't
Code:
padding: 0px; Code:
padding-right: 0px; padding-left: 0px; padding-bottom: 0px; padding-top: 0px; Also, when I'm doing any web design stuff, I validate my code in iCab as I go. iCab has a little smile that is a sad face when your code isn't 100% fit to a standard. It's a very nice feature of the rarely-used browser that works very well and is fast http://www.icab.de
|
|
|
|
|
|
#15 | |
|
Demi-God (Moderator)
Join Date: Oct 2001
Location: San Diego, CA
|
Quote:
Code:
padding: 0; ![]() As far as the original post goes, you really don't need a table in there at all and that's probably why you were having issues. Here's a really simple way to center something (in this case a <p>)that's fairly cross-browser safe: Code:
.center {
text-align: center; /* Needed for older versions of IE */
}
.container {
margin: 0 auto; /* Centers the element for the browsers that "get it". */
width: 200px; /* Can be whatever, but without it it's hard to tell that anything's centered */
}
.container p {
text-align: left; /* Reset the text alignment */
/* Any other styes you need */
}
Code:
<div class="center">
<div class="container">
<p>My centered text.</p>
</div>
</div>
__________________
Join MacRumors.com - Team Folding! Last edited by Rower_CPU : Dec 18, 2005 at 03:17 AM. |
|
|
|
|
|
|
#16 | |
|
macrumors 601
Join Date: Aug 2003
|
Quote:
|
|
|
|
|
|
|
#17 | |||
|
Thread Starter
macrumors 6502a
Join Date: Apr 2005
Location: Monterrey, México
|
Quote:
Quote:
Quote:
This is what I was trying to do (please ignore the colors for now, my PC LCD tells me lies about them), it's sad because it doesn't even look that good afterall:
__________________
"He who will not reason is a bigot; he who cannot is a fool; and he who dares not is a slave."
|
|||
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|