Click to See Complete Forum and Search --> : Whats wrong?
RYLcentral
03-02-2004, 09:31 PM
Hi, currently building a fansite for an MMORPG(massively multiplayer online role playing game).
I'm using the 3 column holy grail layout but im having a problem getting it to work on mozilla.
http://www.rylcentral.com/index2.php
It runs prefect on IE 6 in all resolutions but on Mozilla, not matter what resolution, its all overlapping.
Can anyone tell me whats wrong? I would be most grateful if you can help me with a solution. It's been driving me nutts for a couple hours now heh.
P.S. I'm a designing newbie so if it doesnt look "professional" dont hold it against me.
toicontien
03-02-2004, 10:57 PM
First and foremost, I see an XHTML transitional DOCTYPE, but not a full one. Since it doesn't have the exact URL to the .dtd file, IE could be running in Quirks mode, and thus you might be running into IE6's Quirks mode box model bugs, where it interprets the box model like IE5.x does.
Give the code below a shot. It's the very minimal requirement for XHTML compliant documents.
<!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" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
</body>
</html>
Then cut and paste your BODY HTML, and any other HEAD tags you want, into the new code. Head to http://validator.w3.org/ and validate your HTML first. Then view it in Mozilla. Don't worry about IE. There are waaaaaaayyy too many IE CSS bugs to list here. Basically it can get all of CSS 2.0 wrong at times.
Get the layout to work in Mozilla. Keep the CSS box model in mind:
The box, or total width of an element is:
width: 100px; PLUS
padding-left: 10px; PLUS
padding-right: 10px; PLUS
margin-left: 20px; PLUS
margin-right: 20px; PLUS
border-left: 1px; PLUS
border-right: 1px; TO EQUAL
162 pixels.
That is the standard box model. The IE5.x and IE6/Quirks mode box model is:
width: 100px; PLUS
margin-left: 20px; PLUS
margin-right: 20px;
ABSORB THE PADDING AND BORDERS INTO width: 100px;
TO EQUAL
140 pixels.
Big difference between IE and the standards :)
This was a big long post that says to get your markup to validate before chasing problems in CSS. It's saved my butt on several occassions.
Some great references:
http://www.w3schools.com/
http://www.alistapart.com/
http://www.w3.org/
RYLcentral
03-02-2004, 11:27 PM
Ok it may be the 3 hours of sleep in the past 2 days talking, but im getting this error frequently in the validator
end tag for "img" omitted, but OMITTAG NO was specified
I thought there was no end tag for an img? Or maybe im just reading it wrong.
fredmv
03-02-2004, 11:34 PM
Originally posted by RYLcentral
I thought there was no end tag for an img? Or maybe im just reading it wrong. You are correct; there isn't. However, for your markup to be considered well-formed, you must termniate every element, even "empty" ones. For more on this, see this thread (http://forums.webdeveloper.com/showthread.php?s=&threadid=23947).
RYLcentral
03-03-2004, 12:21 AM
Originally posted by toicontien
Get the layout to work in Mozilla. Keep the CSS box model in mind:
The box, or total width of an element is:
width: 100px; PLUS
padding-left: 10px; PLUS
padding-right: 10px; PLUS
margin-left: 20px; PLUS
margin-right: 20px; PLUS
border-left: 1px; PLUS
border-right: 1px; TO EQUAL
162 pixels.
That is the standard box model. The IE5.x and IE6/Quirks mode box model is:
width: 100px; PLUS
margin-left: 20px; PLUS
margin-right: 20px;
ABSORB THE PADDING AND BORDERS INTO width: 100px;
TO EQUAL
140 pixels.
Big difference between IE and the standards :)
This was a big long post that says to get your markup to validate before chasing problems in CSS. It's saved my butt on several occassions.
Some great references:
http://www.w3schools.com/
http://www.alistapart.com/
http://www.w3.org/
Guess im gunna have to read up some more cause i have no clue what that means lol(remember, im a newbie). My best guess at what you are saying is the page is made up of boxes and each box size is different in IE and mozilla. So sinze Mozilla uses larger boxes then i should use that layout instead?
Frankly i could be interpertating that completely wrong :o
Oh i also finished validating my HTML and CSS. Both are error free now.
toicontien
03-03-2004, 08:42 AM
I'll start out from the very beginning. Things will make more sense then.
There are two types of elements: Block and Inline.
Block elements are placed on a different line than other block elements. Inline elements are placed on the same line as other inline elements, i.e. images are placed on the same line as text, <b>, and <span> tags. Elements like <p>, <li>, and <div> tags are placed, by default on their own line.
Block elements have a box, which is made up of an element's margins, padding, width, height, and borders. The padding and width and height make up the content area. So, the content area, plus the borders, plus the margins make up the box. The box is calculated like so:
Box width:
width +
left padding +
right padding +
left border +
right border +
left margin +
right margin.
Box height:
height +
top padding +
bottom padding +
top border +
bottom border +
top margin +
bottom margin
By default, block elements' widths are as wide as possible. Example: A div is as wide as it can be with no width specified in CSS. If you add a margin, the margin is placed in first, and then the width is calculated as the width available to the DIV, minus the left and right margins.
Also, block elements are ONLY as tall as the tallest thing inside it. Of course padding, borders and margins add to the box height.
Think of your browser window as a series of logical layers:
1. Window
2. Frame
3. Document Flow (AKA CSS layers)
4. Inline / Floated elements
5. Block level elements (standards browsers create a box for the HTML and BODY elements, whereas IE only creates a box for the BODY element)
When you float a block element, it is removed from the Block element layer (layer 5) and places it in layer 4. Inline elements will wrap around floated elements. Floated elements float next to floated elements.
Floated elements, both inline and block, are removed from the block level document flow. Inline floated elements are removed from the inline document flow.
Floated elements are ONLY as tall and ONLY as wide as the tallest and widest elements inside them. They do not take up space in the block or inline layers of the document flow.
Absolutely positioned block elements are removed from the normal document flow created by the BODY tag and placed in a completely new document flow. That's why absolutely positioned elements float over top of the regular body elements.
Absolutely positioned elements are only as wide and only as tall as the widest and tallest stuff inside it.
Those are some basics. I'd still recommend reading up at the three web sites I highlighted in my first post. Hope this helps :)