views:

70

answers:

1

Hi Guys, i have the following html (excerpt from larger code-base)

<div class="diary-event ui-corner-all" title="[title]">
    <span id="delete"></span>
    <div class="diary-event-title ui-corner-all">[title]</div>
    <div class="diary-event-body ui-corner-all">
        <p class="hyphenate">[body]</p>
    </div>
</div>

(where [title] and [body] are dynamically generated strings)

and the Styling for this is as follows:

.ui-corner-all
{
    -moz-border-radius:4px 4px 4px 4px;
}
.diary-event
{
    display:block;
    height:100%;
    position:relative !important;
    vertical-align:top;
    width:100%;
    word-wrap:break-word;
}
table *
{
    margin:0;
    padding:0;
}

#diary-grid
{
    border-collapse:collapse;
}
body
{
    font-family:Arial;
}

now in Firefox, chrome and most other browsers, the relative positioning of this div means it scrolls with the rest of the page, no problems, however for some reason in IE 6 and 7 it acts as if the positioning is static (IE 8 works fine).

At no point in /any/ of the css files is the position referred to as static and i was wondering if anyone has come across this problem before, and if so, how i may fix it.

-Matt

.: UPDATE :.

Just an update on this, i have found that the problem is where JQuery injects the positioning directly into the 'style' section of the main div:

start: function(event, ui)
{
  --->  $(diary_event).attr('style','position: relative'); <----
    diary_event = $(this);
    diary_event_parent = $(this).parent();
}

however if i remove this it breaks the ability to re-drag a dropped element accurately in all other browsers apart from IE,

in other words, i have found where the problem resides, but not how to fix it >_< -Matt

+1  A: 

It's because of a bug in ie6&7. You have just to add position:relative to the "body" element (not your "body" placeholder). http://friendlybit.com/css/ie6-resize-bug/

Hope it helps!

Sigmar
i looked into that, unfortunately that isn't the problem, nor does it fix it, the element appears to be fixed on page load and/or resize.
Matt
I'm not totally sure but I think every position:relative should have a float: left or right to work properly in IE
Sigmar