Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-19-2008, 05:07 AM   PM User | #1
RYann
New to the CF scene

 
Join Date: Nov 2008
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
RYann is an unknown quantity at this point
center aligned and absolute positioned swf IE6 issue

okay, i have a flash title, absolutely positioned the following way:

Code:
.flash	{
	position:absolute;
	top:0px;
	margin-left:auto;
	margin-right:auto;
	right:0px;
	left:0px;
	border:0px;
	z-index:98;
	text-align:center;
}
Code:
<div class="flash" align="center"><script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
  <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','864','height','280','src','swf/logo','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','swf/logo' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="864" height="280">
    <param name="movie" value="swf/logo.swf" />
    <param name="quality" value="high" />
    <param name="wmode" value="transparent" />
    <embed src="swf/logo.swf" width="864" height="280" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed>
  </object>
</noscript></div>
It aligns perfectly to the center in IE7 and FF, but in IE6, the left edge of the swf, sticks flush to the left edge of the browser window.

Getting it to center was a headache enough, and stupid me waits til the end to test in IE6. I have tried everything i can think of and it doesnt move in 6. Anybody know what I could change to get it aligned?
RYann is offline   Reply With Quote
Old 11-19-2008, 07:08 AM   PM User | #2
Doctor_Varney
Regular Coder

 
Doctor_Varney's Avatar
 
Join Date: Mar 2008
Location: Midlands, UK
Posts: 649
Thanks: 45
Thanked 29 Times in 28 Posts
Doctor_Varney will become famous soon enough
Try it like this:

Code:
.flash {
	position:absolute;
        left:50%;
        margin-left:-432px (or as shorthand: margin:0 0 0 -432px;)
        z-index:98;
        text-align:center
}
Now that is, presuming your area for the Flash is going to be 864px wide. Whatever the size, halve it and apply that number as a negative left margin. This should send your element absolute centre-screen. I've had all sorts of trouble with auto margins (btw, it's actually 0 auto) but I've found this simpler and more reliable.

Hope this helps. Let us know how you get on with it.

__________________
Definition: Computer rage is a heightened physiological response with associated feelings of anger and frustration[1] resulting from using a computer or other complex electronic device. It may result in the physical assault of the computer or similar item.[2] Computer use often leads to verbal abuse and occasionally physical violence towards the object.[3] Computer rage may be caused by distress due to a hardware or software problem which the enraged person is unable to correct.

Last edited by Doctor_Varney; 11-19-2008 at 07:15 AM..
Doctor_Varney is offline   Reply With Quote
Users who have thanked Doctor_Varney for this post:
RYann (11-19-2008)
Old 11-19-2008, 07:14 AM   PM User | #3
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
You'd need to use the Deadcentre approach for this. I think it's possible to effectively apply left and right properties together.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 11-19-2008, 07:25 AM   PM User | #4
Doctor_Varney
Regular Coder

 
Doctor_Varney's Avatar
 
Join Date: Mar 2008
Location: Midlands, UK
Posts: 649
Thanks: 45
Thanked 29 Times in 28 Posts
Doctor_Varney will become famous soon enough
Also...

I don't think you need this:
<div class="flash" align="center">

The stylesheet should take care of presentation. Use HTML elements as a raw building blocks and let the CSS do the styling.

__________________
Definition: Computer rage is a heightened physiological response with associated feelings of anger and frustration[1] resulting from using a computer or other complex electronic device. It may result in the physical assault of the computer or similar item.[2] Computer use often leads to verbal abuse and occasionally physical violence towards the object.[3] Computer rage may be caused by distress due to a hardware or software problem which the enraged person is unable to correct.
Doctor_Varney is offline   Reply With Quote
Old 11-19-2008, 10:18 PM   PM User | #5
RYann
New to the CF scene

 
Join Date: Nov 2008
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
RYann is an unknown quantity at this point
thats great thanks a lot. you saved me hours of stress. haha.

and your right, i dont need to align the div, but i just wanted to be sure, ive taken it out now and its fine.

thanks again
RYann is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:04 PM.


Advertisement
Log in to turn off these ads.