共用方式為


Hiding a List Item in IE???

I'm trying to shrink the size of the "Archive" list on the right side of the page.  If you are looking at this blog in firefox you'll see what I mean. (minus the link to "Full Archive" I intend to put there.)  Below is the CSS override that works in firefox. If anyone knows how to make this work in IE let me know.  If your answer involves "make IE fully support CSS 2.0" then your not helping. 

#sidebar-a a#_ctl0__ctl0__ctl0__ctl0_BlogSideBar1__ctl0__ctl1__ctl0_Categories__ctl20_Link{
 visibility:hidden;
position:absolute;
color: white;
left:-999;
}

Comments

  • Anonymous
    April 04, 2005
    In IE you should just need to say 'display: none;' shouldn't you?
  • Anonymous
    April 04, 2005
    The position: absolute is completely broken in IE so it's not a good idea to rely on it. "left:-999" is an incorrect statement according to CSS grammar (a unit is mandatory when the value is not 0), it should be:

    left: -999px

    So try something like that :

    #id
    {
    position: relative ;
    left: -9999px ;
    height: .1px ;
    }

    The height: .1px is used to cancel the vertical spacing between links (because of the display: block).

    Note that the links will not be hidden to screen readers. This CSS technique is mostly used to "show" to screen readers hidden links to visual browsers like "skip to content".

    Hope it will be useful.
  • Anonymous
    April 05, 2005
    Are you hiding it because it pushes your other links too far down the page? Instead of hiding it, do you think it would be better to put it at the bottom of the left column?

    -Scott
  • Anonymous
    April 05, 2005
    How about using the display property.

    #sidebar-a a#_ctl0__ctl0__ctl0__ctl0_BlogSideBar1__ctl0__ctl1__ctl0_Categories__ctl20_Link{
    display:none;
    }

    http://www.w3schools.com/css/pr_class_display.asp
  • Anonymous
    April 05, 2005
    The comment has been removed
  • Anonymous
    April 05, 2005
    Why isn't <li class="inv">stuff</inv> with .inv{ display: none; } working?
  • Anonymous
    April 05, 2005
    The comment has been removed
  • Anonymous
    April 05, 2005
    Of course my answer is for Standards more, not Quirks mode. But I have no respect for Quirks programmers, so that's appropriate.
  • Anonymous
    April 05, 2005
    Follow up:
    a) David: Quirks mode doesn't do anything to the display behaviour or class usage
    b) saving the page with IE results in an UNKNOWN rule for the #sidebar-a a#* selectors. Seems like the CSS parser doesn't like an underscore as first character for an id...
  • Anonymous
    April 05, 2005
    Try:
    Display: none;

    <ul>
    <li>First</li>
    <li Style="Display:none;">Second</li>
    <li>Third</li>
    </ul>
  • Anonymous
    April 06, 2005
    Last comment on this :)

    IE is right (as in: follows the standard) in ignoring IDs that start with an underscore. To quote the relevant part of the HTML standard:

    "D and NAME tokens must begin with a letter ([A-Za-z]" [1]

    So, this seems to be either a bug in ASP.NET or the control used by CS...

    -- b.gr

    [1] http://www.w3.org/TR/html401/types.html#type-id