Forum Moderators: not2easy

Message Too Old, No Replies

CSS Margin/Padding/Border Blues

CSS Spacing

         

kencole

7:22 am on Apr 28, 2007 (gmt 0)

10+ Year Member



Can anyone tell me why there is a space between each row in the tables under FireFox but not under IE7.

I am trying to use XHTML and CSS.

Thanks

Ken

kencole

8:53 am on Apr 28, 2007 (gmt 0)

10+ Year Member



I tries adding a URL to a sample page but then found this wasn't the right thing to do, sorry about that.

Here is my current css and sample html.

<removed>

I have validated the XHTML and CSS. The problem is a gap between the rows in the tables in FF. IE displays it as I would hope. It is a "gap" on the bottom of each row only, well so Firebug appears to show me.

Ken

[edited by: encyclo at 12:55 am (utc) on May 1, 2007]
[edit reason] See Guide to Posting Code [webmasterworld.com] [/edit]

stever

9:35 am on Apr 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Without someone else faffing around recreating all your images, have you tried removing all the table cell contents and then seeing if you still have the same problem? If yes, then the problem is in your original styles. If no, then the problem is with the styles applied to the content. Add the content back in type by type and you should be able to see where the problem is.

(You have, by the way, overlapping styles.)

Dabrowski

12:34 pm on Apr 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You also should look into unobtrusive JS. All that MM_SwapImg stuff is messy, and makes your code hard to read.

I wrote a mouseover/out/click pre-caching image swapper, that's autonomous, only 1 line in your HTML and that's just to call the script in.

kencole

12:50 am on May 1, 2007 (gmt 0)

10+ Year Member



Stever - thanks for that, I will give it a go. I tried creating the page in Nvu, from scratch, but it auto added a 5cm bottom space as well on each TR, or so it appears.

Dabrowski - thanks for the feedback. Any chance you can supply a link to your suggested JS or a document discussing what you did?

Thanks again to both of you.

Ken

Dabrowski

1:10 am on May 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't generally give people answers, but explanations. That way you learn more, which is the point of asking the question?

But here's my init function, and the mechanism to automate it. Should be a step in the right direction so you can build your own code from it. I welcome further questions if you have any.

Basically stick this code in an external js file, for example rollover.js as I call it. In your HTML's <head> add this line:

<script type='text/javascript' src='rollover.js'></script>

That's all the code you need in your HTML. The browser will load the script, which uses the addEvent function to make itself run when the page has loaded, like <body onload=''>.

The page loads and the rolloverInit function is called, which searches for all <img> tags, checks whether to apply the rollover by looking at the name='' property. If needed, the addCache function will pre-load the image, and the addEvent function goes into overdrive here by adding all 4 events to each image.

function rolloverInit() {
var imgs = document.getElementsByTagName( "IMG");
var i;

for( i = 0; i < imgs.length; i++)
if( imgs[ i].name && imgs[ i].name.indexOf( "rollover")!= -1) {
addCache( imgs[ i].src);

addEvent( imgs[ i], "mouseover", mouseHover);
addEvent( imgs[ i], "mousedown", mouseDown);
addEvent( imgs[ i], "mouseup", mouseHover);
addEvent( imgs[ i], "mouseout", mouseUnHover);
}
}

function addEvent(elm, evType, fn, useCapture)
{
//Credit: Function written by Scott Andrews
//(slightly modified)

var ret = 0;

if (elm.addEventListener)
ret = elm.addEventListener(evType, fn, useCapture);
else if (elm.attachEvent)
ret = elm.attachEvent('on' + evType, fn);
else elm['on' + evType] = fn;

return ret;
}

function mouseHover( evt) {
var e = evt ¦¦ event;
var obj = e.target ¦¦ e.srcElement;

obj.src = ............
}

addEvent( window, "load", rolloverInit);

Have fun filling in the blanks! You can probably get some by looking at the existing MM_SwapIng functions.

kencole

1:14 am on May 1, 2007 (gmt 0)

10+ Year Member



Thanks Dabrowski,

I was actually asking for a discussion doc/info rather than code as I agree that you do learn more doing it yourself.

What you have provided is more than enough, thanks again.

Ken

Dabrowski

1:25 am on May 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oh sorry. Can't help you there - I just wrote it. Someone else might have a link for you though.

It's basically keeying your JS completely separate from your HTML, as you would with the CSS. The addEvent function then becomes the starting point of any script.

Good luck!