Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making div content wrap.

Status
Not open for further replies.
Jun 9, 2006
159
US
Ok, this may seem like a super noob question, but please bear with me.

I have a tag as such:

<div style="width:200px;">
A whole lot of content.
</div

Surprising, the content in this box will not wrap. I would like the box to behave so that when its filled with content the text will maintain the width of the div and wrap to the next line.

Can somoen point me to a resource that explains this stuff?

Thanks!



Shawn Molloy
Seattle, WA
 
What browser are you using? It wraps for me on I.E. and Mozilla. Check your code.
Code:
  <div style="width:200px;">
   A whole lot of content.
  [b]</div[/b]

M. Brooks
 
Not sure why you're seeing your box expand. Possibly because your div tag isn't closed? This works fine for me in Fx:

Code:
<html>
<body>
	<div style="width:200px;">
		Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi vehicula venenatis nulla. Vestibulum tellus pede, pellentesque sit amet, tristique vitae, malesuada sed, ligula. Curabitur hendrerit. Praesent odio. Cras odio. Vivamus nisl justo, consequat eget, fringilla id, eleifend ut, nibh. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam pulvinar sapien vel mauris. Nulla facilisi. Mauris consequat. Pellentesque felis urna, suscipit ac, volutpat vitae, semper nec, lorem. Maecenas non lorem nec augue posuere auctor. Quisque tincidunt pede nec metus. Quisque sed turpis. Donec lacus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nam tincidunt. Nulla nisl leo, rutrum quis, tempor ac, dictum eget, nulla. Nunc volutpat.
	</div>
</body>
</html>

Hope this helps,
Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
This is dumb; the problem was that inside this div was an ASP:Datalist control. I changed it to a Repeater and it solved it...

A datalist will output its templated content in a table, where as a repeater outputs in the pure <ItemTemplate> data.

Thanks,



Shawn Molloy
Seattle, WA
 
LOL - Yeah, more so a case of me THINKING I knew the Question, when actually I only knew the Problem.

Just figured you'd rather have a breakdown of the code than 20 lines of ASP.NET code in a CSS forum. :)

-- shawn

Shawn Molloy
Seattle, WA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top