PDA

View Full Version : Hmph.



myke
06-11-2006, 05:16 PM
How can I make a DIV expand to the size of the content in which I have put it? I've done this:



CSS: #content {
position:absolute;
width:680px;
left: 170px;
top: 120px;
border: 1px solid black;}

----------------------------

<div id="content">
<table width="680" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#336699"><marquee>
Welcome to Habbo Positive :-: A positive place full of positive people :-: Visit our forums by clicking <a href="http://www.habbo-positive.co.uk" target="resourcewindow">here</a>
</marquee></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><iframe src="welcome.html" width="100%" height="100%" frameborder="0" scrolling="no" name="main">Your browser doesn't support inline frames</iframe></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">&nbsp;</td>
</tr>
</table>
</div>


I tried using a table but it still doesn't work. p.s. forgive my rubbish coding :] I'm new to it all.

YouFail
06-11-2006, 05:21 PM
Well the whole idea of DIV's has gone out of the window in your coding. DIV's = No need for tables. Remove the table and just type. It'll expand in height for as much as you want.

myke
06-11-2006, 05:26 PM
Ok, I understand that however I'm using Iframes to do the content, the DIV doesn't expand.

---MAD---
06-11-2006, 06:37 PM
Ok, I understand that however I'm using Iframes to do the content, the DIV doesn't expand.
Iframes wont expand as they load everything in them, its like a window in a window basically.

myke
06-11-2006, 06:39 PM
Yes, I know that but it wont expand the div. If I'm wrong tell me and is there a way to get around it? ;[

---MAD---
06-11-2006, 06:43 PM
I am not an expert with divs as I usually use iframes. Most people dislike iframes because of the fact they dont expand.

You will need to use includes I believe.

myke
06-11-2006, 06:52 PM
Any non PHP ways? ;[

RareWolf
06-11-2006, 06:59 PM
you can get iframes which dont use scoll bars and expand,

yes mike that means html

EDIT:

try this

<iframe name="FRAMENAME" id="FRAME ID" src="FILE" width="100%" frameborder="0" allowtransparency="yes" scrolling="no"></iframe>

myke
06-11-2006, 07:16 PM
Nope andy, same thing again ;[

RareWolf
06-11-2006, 07:25 PM
i dont get what you mean [dont know divs]

Joe!
06-11-2006, 07:27 PM
How about just trying a frame?

myke
07-11-2006, 12:43 PM
Can anybody help me? :(

Invent
07-11-2006, 04:27 PM
Right. Remove the tables and just have the divs.

Above the iframe have:


<script type="text/javascript">
//<![CDATA[
window.onload = function() {
var f = document.getElementById("main");
function resize() {
var h = "";
var w = "";
if (f.contentDocument) {
h = f.contentDocument.documentElement.offsetHeight + 20 + "px";
// can't find anything for Opera and Firefox that works for the width. OffetWidth doesn't work right either.(f.contentDocument.documentElement,"").getPropertyValue("width");
} else if (f.contentWindow) {
h = f.contentWindow.document.body.scrollHeight + 5 + "px";
} else {
return;
}
f.setAttribute("height",h);
f.parentNode.setAttribute("height",h);
}
if (window.addEventListener) {
f.onload = resize;
} else if (f.attachEvent) {
f.attachEvent("onload", resize);
} else {
return;
}
resize();
}
//]]>
</script>

Then for your iframe code have:


<iframe src="welcome.html" width="100%" height="100%" frameborder="0" scrolling="no" name="main">Your browser doesn't support inline frames</iframe>

You might have to edit the javascript/iframe to fit your needs. But it should work x)

Geek
07-11-2006, 07:07 PM
If you PM me the graphics and code that you have so far, I will re-code it in fully DIVS if you want, I suppose you could use PHP includes, but why not just intergrate the other webpage into your index.

It is illogical unless using a navigational system, in which holds many many codes, which it would be easier to edit as one HTML file saved as .php can be used as an include.


I am not an expert with divs as I usually use iframes. Most people dislike iframes because of the fact they dont expand.

You will need to use includes I believe.

Sorry to go off-topic and I mean no offence, but how can you be the webpage design manager when you use iframes, they lack any decent browser-compatibility and are a nightmare to get looking good.

Want to hide these adverts? Register an account for free!