473,651 Members | 3,007 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Floating Divs, wraping text outside div. (I am a n00b)

2 New Member
Greetings,

Here is my problem:
The following code shows a div with two small nested divs (images with a title), then the div is closed. Another one opens and a "random text" is displayed.
[HTML]<div style="width: 500px;">
<div style="float: left; padding: 20px;">
Image Title 1<br/>
<img src="test.jpg"/>
</div>
<div style="float: left; padding: 20px;">
Image Title 2<br/>
<img src="test.jpg"/>
</div>
</div>
<div style="width: 500px;">
<p>This is some random text This is some random text This is some random text This is some random text This is some random text This is some random text This is some random text This is some random text This is some random text This is some random text This is some random text This is some random text This is some random text This is some random text This is some random text This is some random text This is some random text This is some random text This is some random text
</p>
</div>[/HTML]

The results show the text in the second main div (random text) shown next to the images. What if I don't want the text to be next to the images, I want it below the first main div? How would I do that? Howcome is the "float: left;" having an effect on the following div?

The only way I can make the "random text" appear under the images is by entering several <br /> which is a dirty solution.

I don't know so much about CSS sorry if my question is n00b-like.

Here is an example of the code posted above:
http://tempblog3344.blogspot.com/

-Ben
Aug 20 '08 #1
2 4222
David Laakso
397 Recognized Expert Contributor
Clear the floats. In the source document, you have:
Expand|Select|Wrap|Line Numbers
  1. <div style="width: 400px;">
  2.  
Change it to (add clear:both;)
Expand|Select|Wrap|Line Numbers
  1. <div style="width: 400px;clear:both;">
  2.  
See CSS 2.1 specs flow-control
Aug 20 '08 #2
benwah1983
2 New Member
Awesome thanks a bunch!
Aug 20 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3720
by: andreas kirschner | last post by:
hello regexp developers, how can i replace text outside a html syntax by using reg exps in php? I mean i have a text like <h3>heading</h3> <p>text</p> <table> <tr> <td>cell1</td>
0
2226
by: Olly | last post by:
I am using the following pure css layout with a header and footer: http://www.fu2k.org/alex/css/layouts/3Col_NN4_FMFM.mhtml The left column floats to the left of the main content (middle column). In the middle column I have 3 divs on top of each other, each of which needs to have a border. To get the borders to display correctly in Netscape 6 and ie5 (windows) I have to put a <br style="clear:both">
1
1687
by: MS | last post by:
Hi, Does anyone know how to get selected text outside the .NET application? For instance: 1) In Internet Explorer, MS Excel or any other, I select some text 2) I perform a mouse click holding a key down 3) My .NET application gets the selected text that was under the mouse cursor when the click was performed.
0
1023
by: MS | last post by:
Hi, Does anyone know how to get selected text outside the .NET application? For instance: 1) In Internet Explorer, MS Excel or any other, I select some text 2) I perform a mouse click holding a key down 3) My .NET application gets the selected text that was under the mouse cursor when the click was performed.
1
6275
by: bryanrite | last post by:
I have two floating divs within a 100% width container div. In IE when you resize the window to the point where the text should wrap, it wraps and extends the height of the container div. In Firefox, the div doesn't wrap but drops below the container div. I can't seem to figure out what i'm missing or what IE is automatically adding for me?? check it out: http://frontstreet.realclip.ca/index.php?pg=local_info * resize the window around...
1
1969
by: StevePBurgess | last post by:
I have a website which, on the main page, has two floating divs. One contains a list of navigation menu items and the other is themain content of the page. Occasionally that div that contains the menu is longer than the div that contains the main content. This displays perfeclty well on Firefox but on internet explorer the bottom bit of the navigation div is chopped off so that it is the same height as the (smaller) main content div.
2
3974
by: Arnost Sobota | last post by:
Hello, Suppose I want to play with DIVs as if they were type characters. I have a series of fixed-height (width is of no importance) blocks which must follow one another from left to right, with a small margin between them. This is easily done with the CSS float:left property. But in this context, what is the proper way to do a Line Feed/Carriage Return? Take a look at the code below for example's sake. I have 8 DIVs and I want to...
4
2927
by: tbirnseth | last post by:
I'm having trouble between IE and FF. For once, IE behaves as I would expect, but FF doesn't. Basically I have a container with two floating DIVs in it. One floats left and the other right. I then have a table which should fill between the two floating DIVs if there is space. If there's not space, it should push down and display as a separately centered table. IE (7) behaves as I would expect, but FF seems to overlay the right side of the...
4
32593
dlite922
by: dlite922 | last post by:
This is just barely above my head when it comes to css. I have a div that needs to contain rows of floating divs, but I need each row not to wrap on to the next one and continue to go right. The user will use a overflow: auto scroll to scroll to see the rest of the divs. illustration: # = === = = === === # = == = = # == ================== # =========
0
8278
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,...
1
8466
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
8584
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
7299
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...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5615
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
4290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1912
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1588
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.