473,883 Members | 1,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FireFox/NS experts: <iframe> inside <div> question -- help pls!

How do I construct a <iframe> or equivalent for FireFox/NS browsers,
inside a screen centered <div> tag? Can it be done?
Jul 23 '05 #1
9 3152
Julia Briggs wrote:
How do I construct a <iframe> or equivalent for FireFox/NS browsers,
inside a screen centered <div> tag? Can it be done?


Does this work for you?

<style type="text/css">
..inline {
background-color: #FFAABB;
text-align: center;
height: 520px;
width: 520px;
}
..if1{
width: 500px;
height: 500px;
}
</style>
<div class="inline">
<iframe class="if1" SRC="http://www.google.com" >
</iframe>
</div>
Jul 23 '05 #2
mscir <ms***@access4l ess.net> wrote in message news:<10******* *****@corp.supe rnews.com>...
Julia Briggs wrote:
How do I construct a <iframe> or equivalent for FireFox/NS browsers,
inside a screen centered <div> tag? Can it be done?


Does this work for you?

<style type="text/css">
.inline {
background-color: #FFAABB;
text-align: center;
height: 520px;
width: 520px;
}
.if1{
width: 500px;
height: 500px;
}
</style>
<div class="inline">
<iframe class="if1" SRC="http://www.google.com" >
</iframe>
</div>


Since this is a JS group, I assume you meant programmaticall y...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>foo</title>
<style type="text/css">

html, body {
width: 100%;
height: 100%;
}
#container {
width: 70%;
height: 70%;
margin: 40px auto;
background: pink;
}

</style>
<script type="text/javascript">
//<![CDATA[

function IFramePopulate( ctr_id, src)
{
var ctr;
if (ctr = document.getEle mentById(ctr_id ))
{
while (ctr.hasChildNo des())
ctr.removeNode( ctr.lastChild);
var ifrm = document.create Element('IFRAME ');
//ifrm.frameBorde r = 0; //optional
ifrm.style.widt h = String(ctr.offs etWidth + 'px');
ifrm.style.heig ht = String(ctr.offs etHeight + 'px');
ctr.appendChild (ifrm);
ifrm.src = src;
}
}

//]]>
</script>
</head>
<body>
<div id="container"> </div>
<div style="text-align:center;"> <a href="#null"
onclick="IFrame Populate('conta iner',
'http://www.google.com' )">go</a></div>
</body>
</html>
Jul 23 '05 #3
RobB wrote:
mscir <ms***@access4l ess.net> wrote in message news:<10******* *****@corp.supe rnews.com>...
Julia Briggs wrote:

How do I construct a <iframe> or equivalent for FireFox/NS browsers,
inside a screen centered <div> tag? Can it be done?


Does this work for you?

<style type="text/css">
.inline {
background-color: #FFAABB;
text-align: center;
height: 520px;
width: 520px;
}
.if1{
width: 500px;
height: 500px;
}
</style>
<div class="inline">
<iframe class="if1" SRC="http://www.google.com" >
</iframe>
</div>

Since this is a JS group, I assume you meant programmaticall y...


Why rely on a JS dependency when its not needed?

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Jul 23 '05 #4
Ok, how can I get that to auto-center as an absolute layer? I've tried
different ways, but can only get it to display in a fixed position.

Julia
Jul 23 '05 #5
Julia Briggs wrote:
Ok, how can I get that to auto-center as an absolute layer? I've tried
different ways, but can only get it to display in a fixed position.


If you mean how can you center the div on the page using CSS, while this
might not be the best newsgroup for a CSS inquiry, did you try:

margin: auto;

maybe something like:

..div1{
width: 420px;
height: 420px;
margin: auto; /* center div on page */
text-align: center; /* center iframe in div */
}

<div class='div1'>
<iframe>
</iframe>
</div>
Jul 23 '05 #6
Julia Briggs wrote:
Ok, how can I get that to auto-center as an absolute layer?


div.layer {
position: absolute;
left: 50%;
width: 200px;
margin-left: -100px;
}

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Jul 23 '05 #7
Toby Inkster <us**********@t obyinkster.co.u k> wrote in message news:<pa******* *************** ******@tobyinks ter.co.uk>...
Julia Briggs wrote:
Ok, how can I get that to auto-center as an absolute layer?
div.layer {
position: absolute;
left: 50%;
width: 200px;
margin-left: -100px;
}

Randy Webb wrote:

Why rely on a JS dependency when its not needed?
Thought I covered that: "Since this is a JS group, I assume you meant
programmaticall y..."

Took the meaning of "construct" as signifying "after load" as
otherwise it's simply an HTML-related query. Could be incorrect,
although this:
Ok, how can I get that to auto-center...


....didn't help elucidate the issue. fwiw...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>foo</title>
<style type="text/css">

html, body {
width: 100%;
height: 100%;
}
#container {
position: relative;
width: 600px;
height: 400px;
margin: 40px auto;
border: 3px #000 double;
background: pink;
}

</style>
<script type="text/javascript">
//<![CDATA[

function IFramePopulate( ctr_id, src)
{
var ctr;
if (ctr = document.getEle mentById(ctr_id ))
{
while (ctr.hasChildNo des())
ctr.removeNode( ctr.lastChild);
var ifrm = document.create Element('IFRAME ');
ctr.appendChild (ifrm);
ifrm.frameBorde r = 0; //optional
ifrm.style.widt h = '450px';
ifrm.style.heig ht = '300px';
ifrm.style.posi tion = 'absolute';
ifrm.style.left = String((ctr.off setWidth - ifrm.offsetWidt h) * .5)
+ 'px';
ifrm.style.top = String((ctr.off setHeight - ifrm.offsetHeig ht) * .5)
+ 'px';
ifrm.src = src;
}
}

//]]>
</script>
</head>
<body>
<div id="container"> </div>
<div style="text-align:center;"> <a href="#null"
onclick="IFrame Populate('conta iner',
'http://www.google.com' )">go</a></div>
</body>
</html>

Yes. I know, it's JS....
Jul 23 '05 #8
RobB wrote:
Toby Inkster <us**********@t obyinkster.co.u k> wrote in message news:<pa******* *************** ******@tobyinks ter.co.uk>...
Julia Briggs wrote:

Ok, how can I get that to auto-center as an absolute layer?


div.layer {
position: absolute;
left: 50%;
width: 200px;
margin-left: -100px;
}


Randy Webb wrote:

Why rely on a JS dependency when its not needed?

Thought I covered that: "Since this is a JS group, I assume you meant
programmaticall y..."


Does that mean if they ask how to set the color of an element, in a JS
group, then you will give them a JS solution instead of an HTML/CSS
solution?

Just because a question is asked in a particular group does not mean
that the answer is necessarily the topic of that group.

But this message is not posted solely to c.l.j, it is also posted to
alt.html

Again, why rely on a JS dependency when its not needed?

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #9
Randy Webb <Hi************ @aol.com> wrote in message news:<B_******* *************@c omcast.com>...
RobB wrote:
Toby Inkster <us**********@t obyinkster.co.u k> wrote in message news:<pa******* *************** ******@tobyinks ter.co.uk>...
Julia Briggs wrote:
Ok, how can I get that to auto-center as an absolute layer?

div.layer {
position: absolute;
left: 50%;
width: 200px;
margin-left: -100px;
}
Randy Webb wrote:

Why rely on a JS dependency when its not needed?

Thought I covered that: "Since this is a JS group, I assume you meant
programmaticall y..."


Does that mean if they ask how to set the color of an element, in a JS
group, then you will give them a JS solution instead of an HTML/CSS
solution?

Just because a question is asked in a particular group does not mean
that the answer is necessarily the topic of that group.

But this message is not posted solely to c.l.j, it is also posted to
alt.html

Again, why rely on a JS dependency when its not needed?


This is silly. Here's the original Q:
How do I construct a <iframe> or equivalent for FireFox/NS browsers,
inside a screen centered <div> tag? Can it be done?
When I read that, it seemed unlikely that anyone would be asking if
they could 'construct' an iframe (HTML) inside a div (HTML) - that's
like posting "can I put a image inside a paragraph?" Not impossible,
but unlikely. I interpreted it as a request for a dynamic solution.
But, you're right, I am deeply ashamed, and I'll never post here again
after this unforgiveable lapse.
Does that mean if they ask how to set the color of an element, in a JS
group, then you will give them a JS solution instead of an HTML/CSS
solution?


Maybe. :D
Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
919
by: Jim M | last post by:
I have had great success with using <iframe> with overflow-y set to auto. I can get a similar look with the <iframe> tag. BUT... In all cases I need to have fixed heights. Is there a way to put either tag inside an HTML <TD> and have the same kind of scrolling effect. This would allow me to fill the screen and have the size of the scrolling box change on resize. Thanks in advance.
3
4370
by: tungchau81 | last post by:
Hi, A Modal Dialog does not allow us to highlight the text content inside <DIV> tag unless I use a <textarea> tag to display that text content. However, the situation of my software makes it impossible to use <textarea> and Modeless dialog. I am really stuck!!! Is there any trick to make <DIV> or <SPAN>'s content be selectable in a Modal dialog? Thanks in advance,
11
4077
by: Jacques | last post by:
I have been writing html/xhtml for nearly as long as I can remember. I do not like frames and stopped using <frameset> a long time ago. But... I have never used <iframe> for anything--never paid any attention to browser support for the iframe element, nor to whatever arguments there are for or against it. Is there any consensus--at least here among subscribers to c.i.w.a.html--over whether usr of the <iframe> tag is or was ever a good...
4
3766
by: sam | last post by:
Hi all, When I use the HTML tidy tool in Firefox I see the following warning which I want to get rid of . I cleared all the errors and warnings it showed except for this one. I am not able to get rid of this, can someone help me find a solution. Warning: <iframe> proprietary attribute "onload" I have the code defined like this where it throws the warning. I have
0
9942
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11142
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10847
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10416
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9574
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7129
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5797
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4220
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.