Results 1 to 8 of 8

Thread: Trouble with buttons in IE

  1. #1
    Join Date
    Jun 2008
    Posts
    40
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default Trouble with buttons in IE

    I was hoping I could get some help with some CSS.

    I've written a small CSS code for the links at the top of my menu. It uses a two span wrapper around a link to create a bubble around the link. It looks fine in Firefox, but I can't get it to look how I'd like it to in IE; the bottom gets cut off. I can't think of any way to fix or any hacks that seem to work. I was hoping to get some thoughts on it.

    The test site is located at http://test.rhovisions.com

    Thanks!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    First off, start with a valid document. Now, that probably has nothing to do with it, but it cannot be ruled out until it is fixed. The page looks virtually identical to me in IE 7, FF 2 and Opera 9.5. In IE 6, there is just a slight misalignment to left of the top section. To create a separate style for IE 6, don't use a hack, use the standard conditional comments:

    Code:
    <!--[if lt IE 7]>
    <style type="text/css">
    put styles here for IE 6 and less
    </style>
    <![endif]-->
    or:

    Code:
    <!--[if lt IE 7]>
    <link rel="stylesheet" href="ie6_and_less.css" type="text/css">
    <![endif]-->
    One or the other of these should follow your main stylesheet(s). Styles set by these will only be used by IE 6 and less. All of the styles in your main stylesheet(s) will also be used by IE 6 and less, so all you need to put in the IE 6 and less specific stylesheet are additions and changes to the main styles.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2008
    Posts
    40
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default

    Thanks for the info... I guess just to check up, because I really hope its not just me...

    But in IE7, the bottom of the buttons get cut off... its hard to see, as the whole thing is very dark (I'll be brightening it up).

    Another quick question: I'm relatively new, so correct me if I'm wrong, but I'm using XHTML 1.1... is that not a valid doctype? Should I use something else?

    Also, I was mistaken with the word "hack". I had seen those conditional statements referred to as "CSS hacks" on other sites, and so assumed those were the hacks.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Just about all DOCTYPES are valid. However, your document is not:

    http://validator.w3.org/check?verbos...visions.com%2F

    To validate with that DOCTYPE would mean (among other things like fixing the markup) serving the page as application/xhtml+xml - if you did that, IE wouldn't even parse it. Try HTML 4.01 strict or loose. You are right about the button cutoff, I didn't notice it. But, gotta run for now, this works in IE 6:

    Code:
    <!--[if lt IE 7]>
    <style type="text/css">
    #header {
    position:relative;
    left:10px;
    }
    </style>
    <![endif]-->
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Back now, this looked good for IE 7:

    Code:
    <!--[if IE 7]>
    <style type="text/css">
    span.button {
    position:relative;
    top:-1px;
    }
    span.button a {
    padding-bottom:3px!important;
    display:inline-block;
    }
    </style>
    <![endif]-->
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Jun 2008
    Posts
    40
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default

    I can put those fixes straight into the .css right? by removing the style tags? And do I have to put them in at the end? Because when I add one (such as the IE7 fixes), it doesn't seem to make a difference if I have the relative line or not, or the top line (for span.button). Either way, it does the same thing.

    EDIT: In fact, nothing seems to be working. If I put a tag of any sort, it changes how the tag works, but doesn't actually effect the tag (I just tried adding a border around the header, nothing).

    My code, pasted from the bottom of my stylesheet, is

    Code:
    <!--if IE 7]>
    #header {
    border: 1px solid white;
    }
    <![endif]-->

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    They have to be separate stylesheets. See:

    http://www.dynamicdrive.com/forums/s...96&postcount=2

    from this thread where I stated that. You can either put them on the page after your main stylesheet link, or you can make up separate external stylesheets and link to them from within the comment areas. Either way, they still have to be after the main stylesheet link. The key concept is that this part:

    Code:
    <!--if IE 7]>
    
    <![endif]-->
    is seen as an HTML comment to all non-qualifying browsers, so it must be on the page.

    I just looked at your source code and saw:

    Code:
    	<link href="/styles/rhovisions.css" rel="stylesheet" type="text/css">
    	<!--[if IE]>
    	<link href="/styles/rhovisions_ie7.css" rel="stylesheet" type="text/css">
    	<![endif]-->
    And the page is working better in IE 7, so it looks like you are getting the idea.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. The Following User Says Thank You to jscheuer1 For This Useful Post:

    Keleth (07-11-2008)

  9. #8
    Join Date
    Jun 2008
    Posts
    40
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default

    I kept toying around with it and yah, I am understanding it better, thanks a lot.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •