473,395 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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 4198
David Laakso
397 Expert 256MB
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
Awesome thanks a bunch!
Aug 20 '08 #3

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

Similar topics

1
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
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...
1
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...
0
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...
1
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...
1
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...
2
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...
4
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...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...

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.