This is a discussion on "What's up with margins and padding in IE?" within the Web Page Design section. This forum, and the thread "What's up with margins and padding in IE? are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
What's up with margins and padding in IE?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
What's up with margins and padding in IE?
I came up with (what I believe is) a new/unique way of doing css rollovers with images as links. My nav box is white, and the same width as all the images to be used as links. (The images are really just text, but they're made using a font that's perfect for the site.) The images have a white background (to match the nav container) and I stack them vertically with a few pixels of vertical padding. I then set
At least, that's the theory. It works great in FF, IE7, Opera, Safari, etc. but in IE6, something is not quite right. The padding gets screwed up and then the links (and the page) get all "jumpy". Here's a link where you can see it in action: http://stickpuppy.com/dhs57/welcome.html (Be sure to check it out in both a modern browser and a pre-7 version of IE.) If anyone can point me toward why this is happening, I'd sure appreciate it! |
|
|
|
|||
|
Re: What's up with margins and padding in IE?
Here's a good navigation to stop the flicker http://www.tanfa.co.uk/css/examples/...no-preload.asp
|
|
||||
|
Re: What's up with margins and padding in IE?
Here's what you can do to make it work x-browser
|
|
|||
|
Re: What's up with margins and padding in IE?
Thanks for the help, guys, but I'm not using thebackground-position trick with two images in one (sliding them around as necessary.) This is a whole different animal (and all my searching hasn't turned up any documentation of this method, so, for now at least, I'm taking credit for inventing "the Donny Bahama css rollovers"!
I'm using single, static images. 100% of each image is shown at all times, so the width is set and set properly from the beginning. The background (as well as the width) of my images are the same color (and width) as the sidebar container they're in, but there's 4 pixels of padding above and below each one. On hover, I set the background color for the image to a different color - specifically, the same color as my page background (which surrounds the sidebar container.) I think it looks great - when it's viewed in modern, standards-compliant browsers. But IE does something funky with that padding I'm using that I don't understand, and as a result, the rollover borders aren't a consistent thickness and some (not always all) of the images get dislodged and shoved around (albeit ever so slightly) when another image is highlighted.
|
|
|||
|
Re: What's up with margins and padding in IE?
The understanding was mine. I thought you were telling me to add the code you had posted to my code - and I didn't understand how adding left and right borders was going to do anything for me.
|
|
|||
|
Re: What's up with margins and padding in IE?
I just tried to implement yours and it didn't work in IE 5.5... the border doesn't change color. (I thought I remembered trying to change the border color and having problems with it.)
|
|
|||
|
Re: What's up with margins and padding in IE?
Quote:
Thanks for the help, Ryan! |
|
||||
|
Re: What's up with margins and padding in IE?
Doh, make that border-width: 3px 0; not 0 3px. Hm. Maybe IE 5 doesn't like a:hover img. I guess I don't know about that one. Anyway, I would NEVER use the img tag for navigation. Ever.
|
|
|||
|
Re: What's up with margins and padding in IE?
OK - I'm giving this a try, but I'm curious about the above statement. Is it because of semantics? I have a list of links, ergo <li> is the properly descriptive element? Or is there more to it than that? (I want to understand, Obi Wan.)
Quote:
1. If I send .nav -5000 pixels into nowhere land, how are my bgimages going to show up where I want them? 2. Isn't the text from the <li> going to sit on top of my bgimages and look like muck? (I'm guessing the same answer applies to both these questions.) 3. I can't specify a height for .nav li a {} because the height of the bgimages varies... is it safe to omit it and let the browser figure it out based on the hight of the bgimage? Or should/can I specify height individually on each of the .nav li.reunion a{} selectors? |
|
||||
|
Re: What's up with margins and padding in IE?
It makes the text move 5000 pixels to the left, but the background image will be in the proper place. Hence, the text is hidden, but your images show up. No, you must specify the height. If they are different, you can include it in .nav li.reunion a { height: 35px; } or .nav li.accommodations li a { height: 40px; }
That answer everything? |
|
|||
|
Re: What's up with margins and padding in IE?
Almost... how well-supported is the "text-indent" property? This won't crumble on older browsers? Couldn't I just set the text-color for the <li>s to transparent? (Or can you only use transparent for background?)
And then there's the question of why I should NEVER use images for navigation. Ever. I really appreciate all the help, Ryan! Last edited by Donny Bahama; Apr 16th, 2007 at 02:51. |
|
|||
|
Re: What's up with margins and padding in IE?
OK. That didn't work out well! In FF, all hover borders show all the time (so, of course, there's no rollover effect.) In IE55, my navbar shrunk down to this small white box with bullets down the left side of it! (No bgimages visible, no links, and no rollovers.)
So far, I had better x-browser compatibility where I started. Maybe there's something to "the Donny Bahama css rollovers" after all! |
|
|||
|
Re: What's up with margins and padding in IE?
OK, so first of all, I was wrong about the behavior in FF. After a hard refresh, it was much the same as IE55 - empty white box, bullets to the left. I thought maybe
Quote:
Everything looks OK to me. Apart from not understanding the behaviors of ul's as menus, it looks like it ought to work. |
|
|||
|
Re: What's up with margins and padding in IE?
If you use images for navigation with out a text fallback then there a few issues. My main concern with images based nav is accessibility - how are people using assisitive technology which often reads what is on screen (from the code) supposed to know what nav item is what? Alt text is good as are titles but pure text in the html is better.
It's also bad for seo as the little search robots read your code in much the same way as a screen reader does. So good seo is good for accessibility too. It's great the way things work out, don't you think. Pete. |
|
||||
|
Re: What's up with margins and padding in IE?
Oh dear, I've been having a heck of a time checking my code. I should've applied the classes to the <li>'s instead of the anchors. I'm not making this as easy as I should! Um. After you changed that, like you did (it's great to see that you knew what to do, by the way), what did the page look like?
|
|
|||
|
Re: What's up with margins and padding in IE?
Quote:
SEO - that makes sense. All the alumni have been notified by mail that the site is up (albeit partially up) so I don't know that anyone involved in this particular project cares about search engine ranking, but for future reference, I probably ought to refrain from bad habits now. |
|
|||
|
Re: What's up with margins and padding in IE?
Quote:
Quote:
Quote:
|
|
|||
|
Re: What's up with margins and padding in IE?
Progress...
I experimented with different variations of
No matter what I do, though, I can't get the borders to change color on hover. For a minute I thought I had it - I needed to add 6 pixels (to allow for the 3px top+bottom border) to the height declaration for each selector that declared a bgimage. Alas, that did not do the trick. I'm at wit's end. Tried everything I could think of and I'm close, but no rolllovers. :surrender: Here's a link in case anyone wants to check it out in Firebug... http://stickpuppy.com/dhs57/welcome.new.php |
|
|||
|
Is this meaningful?
As I said, when I look under the hood using Firebug, it appears to be ignoring the border-width. Instead, it's inheriting it from a * section at the beginning of the css file:
:blowup: |
![]() |
| Tags |
| css rollovers |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Margins in IE are different than Firefox | KiwiTaicho | Web Page Design | 3 | Sep 28th, 2007 14:57 |
| collapsing page margins | aflacduck | Starting Out | 15 | Jul 9th, 2007 19:31 |
| Margins need fixing | notagz1 | Starting Out | 9 | May 28th, 2007 14:03 |
| ff margins | Dapandyman | Web Page Design | 10 | Feb 12th, 2007 23:03 |
| body margins | benbacardi | Web Page Design | 2 | Apr 10th, 2004 14:51 |