HTML - Floating A Div From Within Another Div
Prevous title: (div in div top:0; left:0; = top corner of first div, not page...)
Ok, here's the code: HTML Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>DIV DIV</title> <style type="text/css"> <!-- #apDiv1 {position:absolute;top:0;left:0;width:150px;height:150px;z-index:0;background-color:#00F;} #apDiv2 {position:absolute;top:100px;left:100px;width:200px;height:200px;z-index:1;background-color:#F00;} --> </style> </head> <body> <div id="apDiv1"></div> <div id="apDiv2"> </div> </body> </html> Which produces: However, the "problem" is that i would like that result with this variation on the code: HTML Code: <div id="apDiv2"> <div id="apDiv1"></div> </div> But that "unfortunately" returns this result: Which was great when I first did it, (i always thought top:0; left:0; would put a div in the top corner of the page regardless of where it is within the code... so when i tried it in my last project and it used the top corner of the containing div as 0,0 that was exactly what i needed) but in my current project, I really need div1 to go to the top corner of the page, not div2, but still reside inside of div2... is this possible? Similar TutorialsHi all, Sure glad I found this site!, I would like to ask for some advice please guys I have a portal that uses a portal stylesheet, the header is a .png image and needs to be 100% width, this loads from a Content Web File Manager, it carries a logo on the left and some corperate colour bands, it appears on every page of the portal, the right side is blank apart from the picture of a search box ( it shipped with the png I will be getting rid of this using PSP) I have created a <div> content </div> and I want this to appear to the right and in front of the header in place of this search box The <div> loads fine on templates (the dynamic content of the portal these are templates that the site use) so I know this works fine, now i want to make it appear on the header itself in place of the picture of the search box that I have erased This is where I am getting stuck - I do want it to be a permanent feature on the header and to the right, what do I need to use in the html code before and after the <div> content </div> ? All help will be greatly appreciated John Hey, Ive seen this done a few times and i was wondering if aqnyone knoew how hard it is or how to achieve it. When the user clicks on a button i want either an image or text to appear next to it. Im sorry i cant find any examples but i have seen it done in places. Thanks, Ben Hi everyone, Me again I'm afraid. Hope you had a good Christmas and New Year. I have a question regarding the following page: http://www.dynamic-xchange.com/resources.php I am trying to update it as I have done with the others (http://www.dynamic-xchange.com/index.php) and implement XHTML and CSS but I am having problems floating the divs correctly to get the desired effect as in the page given above. Any help of advice would be very welcome as I am tearing my hair out. Warm regards, Simon Hello, I am trying to create a web page, and, currently, there is text at the top, and text at the bottom displaying copyright information and useful links. I am aiming to have this page fit into one page, without the need for scrolling, with an iframe in the middle. (So the user is not taken away from the page to complete the task). However, I have the text at the top, the iframe set to 78%, and useful links at the bottom. It works in most browsers without needing to scroll, however, when you use the page in IE, you need to scroll to see the very last bit. Is there a way, I could "float" a section at the bottom of the page, so it doesn't disappear? can anybody please help with this html document, i need to have all the picturecs in the right places.. i cant seen to figure it out, i will only take a minut for someone who know what to do ! http://peecee.dk/upload/view/174763 Hi, How can I get my jquery gallery to appear in the center and the columns on the side to auto fit around it? The gallery is currently hanging over the right column. http://elitedonuts.com/float3.html THX! Hello, I've came here because I am really stuck on this one problem... I can't float another DIV right so it's beside another DIV. ( http://www.lentonent.com ) Please could you fix this source code so one div is on the left and one is on the right and they both have a background of middle.png: Code: <html> <head> <style> #middle { width: 900px; background: url(images/middle.png) repeat-y; } #middle-left { width: 580px; padding: 25px; border: 1px solid #000; } #middle-right { width: 200px; padding: 25px; border: 1px solid #000; float: right; } </style> </head> <body> <div id="middle"> <div id="middle-left"> <h1>LEFT SIDE</h1> <p>This text should be on the left hand side. I'm just going to write a little crap now to make this paragraph really long and cool just like a frog standing on a spoon. Yes very random indeed but that's not what the bus shelter said.</p> <h1>LEFT SIDE</h1> <p>This text should be on the left hand side. I'm just going to write a little crap now to make this paragraph really long and cool just like a frog standing on a spoon. Yes very random indeed but that's not what the bus shelter said.</p> </div> <div id="middle-right"> <h1>Test</h1> <p>This is a test.</p> </div> </div> </body> </html> Thankyou very much for your help! i have a iframe code im using to run a scrolling text, im wondering if i can get the iframe to float on the right side of the screen... i tried adding stye="float: right but it didnt work heres the code im using below and you can see a preview of the outcome at http://www.freewebs.com/fallingrain11/test2.htm document.write('<iframe id="datamain" src="'+iframesrc+'" width="165px" height="215px" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"; style="float: right></iframe>') okay guys so i made a theme and here's the out come ( i wont make it appear because its so big ) http://i.imgur.com/LyM41.png but i want to put an i frame on the middle part like this http://i.imgur.com/Fw6fP.png w/ transparency but still the image is still there so it will look like this http://i.imgur.com/CUP1k.png can any one help me with the code? http://i.imgur.com/t9zrr.png How do I make text appear above lowercase characters? http://tinypic.com/r/1t4igj/5 How can I make a floating social media sidebar like this one? Hey all, new guy here, working on a page for my work place. I work in a call center and all our support documentation we upload to a web-site so its quickly and easily accessible. My predecessor had a very basic setup designed in MS Word but the site has grown way too big for Word now. Its my baby now and I have been designing it over the past couple months as I have had time, complete re-write yah! in any case, after getting the design and setup down, I moved on to the coding using a mix of Dreamweaver and straight up HTML(how I learned in college). Built a frames version and hated it, so after reviewing all the options I opted to go with SSI for the menu. I built the menu, its simply 2 tables, 1 runs the full width along the top, the other floats left. Here is a screen-cap - company logo and other info blocked off. OK, everything is fine, so far, but the main/index page will have to have a lot of links. We have 1 page for every app. IE. Groupwise as shown. The apps are ordered alphabetically and I will need 2 or 3 columns and will need to be able to jump in and add an app in the middle of the list quick and easy. Simple answer: tables. Not so simple though.... most people resize the IE window down so they can keep working on one thing and read off the page... When I tested resizing the window this happens... *again, info removed* Before a scroll-bar appears, the tables drop down BELOW the side menu table from the SSI file... I have tried everything I can think of to fix this and just cannot get it to work... I tried playing with the side menu table height, (currently set to 100% to fill up remainder of page) and have even tried setting the top menu to a set width so that a scroll bar will appear if you do anything but full screen, even then when too small the tables jump down to below the side menu. I even split the side and top menu to 2 seperate SSI files and it does the same thing(and has a big space between the 2)... Plain text will jump down as well, but only after you make the window too narrow to have a single character next to the menu. Any help would be greatly appreciated. Suggestions on what to try? where to look for an answer? or if I am going about this all wrong.... what I should be trying... Thanks in advance! -Tim I am making a website using Dreamweaver CS3. I am actually making a template page that contains 3 columns with a header and footer. I want to make the height of the left and right columns float to match the length of the center column. The center column will always contain more content than the side columns. The code for the left column is below: .thrColAbsHdr #sidebar1 { position: absolute; top: 120px; left: 0; width: 160px; background: #fff9d9; padding: 5px 5px 5px 5px; Any input would be helpful. Thank you EDIT: Problem Solved. Thank You. Hi, first question as a new user so here goes... As part of a website I'm designing I'm trying to create a fairly simple layout with two DIVs, one for an image and one for text, like in the picture below: http://www.eastwood6.co.uk/layout.gif I'm having problems getting the second smaller DIV (the one with the text in) to stay to the right of the first smaller DIV (with the image). I have floated the first DIV to the left, but I found that the text wraps underneath the image when the text is longer than the image. I tried floating the second DIV to the left as well, and this worked fine in IE, but it causes problems in Firefox, namely that the entire second DIV is pushed below the first. I've been messing with this all morning and just cannot solve it, any help would be greatly appreciated! Here's the code I've been playing with: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> <title>Test</title> <style type="text/css"> * { padding: 0; margin: 0; } #one { width:50%; border: 1px solid black; } #two { float: left; border: 1px solid orange; } #three { width: 400px; } </style> </head> <body> <div id="one"> <div id="two">This is the left box</div> <div id="three">This is the right box. Now I just want to see what happens when I type so much text that it flows off the end. This is the right box. Now I just want to see what happens when I type so much text that it flows off the end. This is the right box. Now I just want to see what happens when I type so much text that it flows off the end.</div> </div> <div style="clear: both;"><p> </p></div> </body> </html> Thanks, Pete I am looking to put a floating menu on the right and a floating facebook box on the left side of my website. Can someone help me by telling me how to do one or both of these things. or.. Can some help me by telling me where to go to find out how to do it? Thanks ! Hi, I'm doing a website and for my link i would like drop-down menus at the top but i want it to stay at the top when you scroll. Can anybody point me to these. I have no idea how to do drop-down menus that look good. Take a look at http://www.runehq.com/ and look at the menus at the top. I would like some like that. Help would be great. Thanks. ToshNeox Hello please see http://www.view-agency.com/view/Repr...x?Id=243&Cat=2 in all the RepresentedEng.aspx The .main_wrap class floats to the right, although it's inside a class that has same width and margin auto ... anyone ? ? What's even wierder is that on http://www.view-agency.com/view/Cate...Eng.aspx?cat=2 for instance, there is no floating problem although it's supposed to work on same css.... Comment - Don't bother explaning to me that it's not valid and code isn't 100% right because I didn't make it, and it ain't possible to make the site all over. I'm sure there's a way to fix this tiny problem.. Thanks !!!!! hi i am having a real problem with some divs. i have a div which has a transparent background and i wanted the text on it not to be transparent so i made a new div and put it on top of it by making its position absolute. this works fine my problem is when i try to create a new div which is meant to be next to my original div it either appears on top of the original or underneath it even though their is plenty of room next to it. my code is he HTML Code: <head> <style type="text/css"> body{ background-image:url(135_o.jpg); padding:40px 40px 40px 40px; text-align:center; } h3{ color:#FFF; } #ontop{ position:absolute; top:48px; text-decoration:underline; width:195px; height:395px; border:5px solid black; text-align:center; } #boxDiv{ width:200px; height:400px; font-family:Arial; font-size:16px; background-color:#999; opacity:0.3; } #middlediv{ width:200px; height:400px; background-color:#ff9900; } #container{ width:900px; height:500px; border:2px dashed white; } </style> </head> <body> <div id="container"> <div id="ontop"> <h3>Accommodation</h3> </div> <div id="boxDiv"> </div> <div id="middlediv"> </div> </div> </body> </html> i have also included a screen of what is happening: any help would be great thanks. Hi everyone I've developed a website and now when it got ready someone discovered that the sidebar isn't floating correctly in his mozilla firefox. It works fine in my firefox and IE and in his IE, but not in his FF. So I have a screenie how it looks like when it's wrong and when it's right: Right: Wrong: The source is at www.latvala.com Please help me |