View Full Version : CSS Positioning Using both Absolute and Relative
juh915
07-28-2002, 02:18 AM
Hi, is it possible to use both relative and absolute positioning on a single layer?
thanks,
Justin
Mhtml
07-28-2002, 02:40 AM
Actually, I'm not sure. But I would think that you could only have it relatively or absolutely positioned not both. What are you trying to do? Is this a cross browser issue or just curiosity? Because If it's cross browser you would just specify what to relative or absolute in which browser.
juh915
07-28-2002, 03:16 AM
thanks,
yeah it's a cross browser problem. i guess i should make a different style per browser then. ugh!
justin
redhead
07-28-2002, 08:15 PM
which browsers do you want to be relative and which do you want to be absolute?
you could try something like this, presuming you wanted IE to be absolute and eveything else to be relative (and the object to have the ID "postion_me"):
<script language="JavaScript" type="text/javascript">
if (document.all) {
document.all.position_me.style.visibility="absolute";
document.all.position_me.style.top="100";
document.all.position_me.style.left="200";
}
if (document.layers) {
document.position_me.position="relative"
}
if (!document.all && document.getElementById) {
document.getElementById("position_me").style.position="relative"
}
else {
document.writeln('You badly need to get with the times, get a new browser...')
}
</script>
hope that helps, happy coding :thumbsup:
mouse
07-28-2002, 09:27 PM
relative and absolute are totally different so no you can't apply them to the same layer.
relative positions relative to its position in the html page, absolut positions relative to the page borders.
joh6nn
07-29-2002, 05:54 AM
here's an article about setting up separate style sheets for different browsers:
http://www.evolt.org/article/Assigning_browser_specific_styles/17/14732/index.html
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.