views:

74

answers:

3

I am trying to move a table up by 6px.

There is a table immediately above it, so this means they will have to overlap. Is this possible?

I have tried

.subNavBar {
    position: relative;
    top: -6px;
}

and

.subNavBar {
    position: absolute;
    top: -6px; 
}
+2  A: 
.subNavBar {
    position: absolute/relative;
    margin-top: -6px;
}

Btw: You can IMHO overlap anything with anything. position: absolute and z-index are your friends. ;-)

Philippe Gerber
why do you have such an honest opinion about overlapping? :p
peirix
hehe, you're right ... an AFAIK would've been more appropriate ^^
Philippe Gerber
+1  A: 

Negative margins can cause problems in some browsers (here's looking at you, old IE). Also, with a negative margin the position attribute is irrelevant.

I'm surprised that your first attempt {position: relative; top: -6px;} didn't achieve what you wanted. It's how I would have done it, and it works fine for me in FF3, IE7, Chrome2, Safari4 and Opera9.61

Here's what I did to test, so you can see the code: http://www.darine.org/table_overlap.htm

If there is anything else you're doing with your table styles that make the situation more complex, I can't guarantee no conflicts :(

Matt Sach
Yes and this also create problem in cross browser compatibility. You can have two different view of this in tow different browsers.
Umesh Aawte