Solved

inline frame center alignment

Posted on 2013-11-22
12
303 Views
Last Modified: 2013-12-29
Here is the page, http://lakecountyshoppingguide.com/latestissue/default.html .  I have an inline frame with a flash slide show embedded.  I am trying to center it in the page but it just stays left justified in IE and Firefox.  It is centered in Chrome.
0
Comment
Question by:northernknight
  • 5
  • 3
  • 2
12 Comments
 
LVL 15

Expert Comment

by:Insoftservice
ID: 39671006
Do you have access to the iframe code?
If not then we can't do any thing for it
0
 
LVL 42

Expert Comment

by:Chris Stanyon
ID: 39671234
You can't change the content of the iFrame, but you can change the dimensions of the iFrame itself, and it will centre.

<iframe style="width: 800px; height: 600px;" src="../nov2013/shoppingguide/shoppingguide.swf" name="I1" marginwidth="100" id="I1">
...
</iframe>

Open in new window

0
 
LVL 1

Author Comment

by:northernknight
ID: 39672231
Yes, I have access to the iframe code.
I can center the  iframe but the flash slide show is left justified.  I need to be able to center the slide show.
0
 
LVL 42

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 39672488
Your whole page is a little off throughout. The iFrame is wrapped in a 900px wide P tag, which is wrapped inside a 570px wide column1 DIV. The actual Flash movie inside your iFrame is set to a width of 100%, but this won't scale it - it just adds white space to the right. You can't centre an element that is 100% wide.

There are several ways of acheiving what you want - you could centre the P in the DIV, you could centre the iFrame in the P, or you could centre the Flash movie in the iFrame.

Which ever method you choose, you will need to sort out your widths.

To centre the iFrame, remove the width and float from #column1. Then change the width of your iFrame from 900px to 800px. That will centre the iFrame. There is no such thing as float:centre so remove that from your iFrame.
0
 
LVL 42

Assisted Solution

by:Chris Stanyon
Chris Stanyon earned 500 total points
ID: 39672490
If you want to centre the slideshow within the iFrame, then in the page that contains it, change the width from 100%  to 800px and add a text-align:center to the <body> tag
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Author Comment

by:northernknight
ID: 39673243
The auto-style1 has the text align center tag in it already.  I think I need to redo the flash show to not have the 100%

The column tag is site wide and is in the master template and css.  The last flash show I had in there was centered, but I just changed it.  So I will take a look at the new one.
0
 
LVL 42

Assisted Solution

by:Chris Stanyon
Chris Stanyon earned 500 total points
ID: 39673397
Yes - the auto-style1 does have text-align:center, but you also set that paragraph to a width of 900px, so the content is centred within that width.

Having a site-wide column that is 570px wide, and trying to force 800px wide content into it will always cause you problems. You may need to re-think that part.

Probably the easiest thing to do here is to chagne the width of P tag to 970px, and then change the width of your iFrame to 800px;

That will centre the whole thing
0
 
LVL 15

Expert Comment

by:Insoftservice
ID: 39673729
agree with @ChrisStanyon

Try to add below lines in iframe. might might might help

<!DOCTYPE html>
<html>
0
 
LVL 1

Author Comment

by:northernknight
ID: 39675956
So I changed the margins but it still only centers in Chrome but not IE and Firefox.
0
 
LVL 42

Expert Comment

by:Chris Stanyon
ID: 39676324
Looks centred to me - tested in Firefox, Chrome and IE - centred in all of them

Maybe clear your cache and try again.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now