Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Position relative ignored in innerHTML
Message
From
26/02/2017 02:03:27
 
 
To
All
General information
Forum:
CSS
Category:
Coding, syntax and commands
Title:
Position relative ignored in innerHTML
Miscellaneous
Thread ID:
01648528
Message ID:
01648528
Views:
40
I have an initialization of a div through javascript such as this:
window.parent.oDiv.innerHTML="Something"
Now, I need to include some HTML in there for a div which contains some relative positioning. That would be an example:
window.parent.oDiv.innerHTML="<style>.DivSlideshow {position: relative;}</style><div class=DivSlideshow><div class=DivSlideshowChild>Test</div></div>"
Basically, in the initialization of the div, I am passing some styles and some Html. The goal is to have a child element to benefit of absolute positioning as per the parent.

As is, if I only build a page as this:
<style>
.DivSlideshow
{
   position: relative;
}

.DivSlideshowX
{
   position: absolute;
   top: 10;
   right: 10;
}
</style>

<div class="DivSlideshow">

<div><img src="00000001.jpg" style="width: 1000px; height: 750px;"></div>

<div class="DivSlideshowX">X</div>

</div>
...it would work.

Thus, the X would be included in the parent aligned right.

But, when passing that code through Javascript in innerHtml, the relative declaration does not work.

Are there special considerations in regards to how the relative positioning works when doing such?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform