Forum Moderators: not2easy

Message Too Old, No Replies

Text won't wrap - flows out of containg div

Trouble getting text to fit inside a div's boundaries

         

jack2501

1:43 am on Mar 30, 2008 (gmt 0)

10+ Year Member



Hi,

I was hoping to get some help with a text flow problem - text doesn't wrap properly within a div.

The text is in mainText, which is inside the div called mainContent.

It appears that the browser thinks the div is a bit bigger that it actually is, because the text extends beyond the right-hand border before moving down to the next line.
I've tried all I can to eliminate this problem but I cannot find a solution, any help is much appreciated.

You can see a picture of the problem here:<>
---- CODE IS BELOW -----

CSS

...

#mainContent{width:798px;
min-height:500px;
height:auto !important; /*CSS min-height hack*/
height:500px;
margin:0 auto 0 auto;
background-image:url(../Images/gradientBackground.jpg);
background-repeat:repeat-x;
background-position:bottom left;
border-left: 1px solid #f4e19e;
border-right: 1px solid #f4e19e;
border-bottom: 1px solid #f4e19e;
clear:left;
}

#mainText{padding:0px 10px 0px 10px;
font: 1.1em "Myriad Pro", "Trebuchet MS", Arial, Helvetica, sans-serif;
width:778px;
text-align:left;
color: #000;*/
letter-spacing:normal;
}

...

HTML

...

<div id="mainContent">

<div id="mainText">

<div class="pageHeader">Strategic Planning</div>
<!-- <div style="width:250px; margin-top:40px; margin-right:20px; float:right;" class="quote">QUOTE</div> -->
<br />

<p>You can’t hit a target you can see. Aha! Consulting works with organisational through planning processes that
range form one day facilitated workshops to through processes that allow organisation to:</p>

<ul style="line-height:1.5em;">
<li>Review the external operating environment and consider its strategic impact on the organisation</li>
<li>Assess how the organisation is currently performing</li>
<li>Understand the views of staff, clients and external stakeholders</li>
<li>Confirm/review the potential directions/vision and opportunities for the future</li>
<li>Identify any potential barriers to achieving this direction</li>
<li>Identify the type of culture that will align to this direction</li>
<li>Articulate this direction in simple, accessible and measurable language</li>
<li>Set a clear pathway for the conversion of the plan into action</li>
</ul>
<p>Aha! Consulting is NOT an hired expert to tell you which way to go. Our expertise is in gathering the information and providing the process for
the organisation to have meaningful, informed discussions that lead to clear achievable outcomes.</p>

Click <a href="link.html">here </a>to download examples of strategic plans completed with the assistance of Aha! Consulting.
<br />

</div>

<div style="bottom:0px; height:296px; background-image:url(../Images/watermark.jpg); background-position:bottom right; background-repeat:no-repeat;"></div>
</div>


...

[edited by: SuzyUK at 10:03 am (utc) on Mar. 31, 2008]
[edit reason] no personal URI's please, see charter [/edit]

D_Blackwell

3:07 pm on Mar 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1. Welcome to WebmasterWorld.

2. No personal links

3. I hacked in a thick, red border that I could actually see and am not replicating the problem described. The text is contained within the box on several versions of several browsers and at numerous displayed sizes.

4. Do you need the widths? Cutting them out will eliminate all the horizontal scrolling at narrow widths. (Perhaps margin: and padding: can be used if necessary.?)

5. Do you really need all that height stuff? Not saying that you don't. Just asking.


<style>
#mainContent {
/*
width:798px;
*/
/*
min-height:500px;
height:auto !important;
height:500px;
*/
margin:0 auto 0 auto;
background-image:url(../Images/gradientBackground.jpg);
background-repeat:repeat-x;
background-position:bottom left;
border: .2em solid red;
clear:left;
}

#mainText{padding:0px 10px 0px 10px;
font: 1.1em "Myriad Pro", "Trebuchet MS", Arial, Helvetica, sans-serif;
/*
width:778px;
*/
text-align:left;
color: #000;
letter-spacing:normal;
}
</style>

jack2501

8:58 pm on Mar 30, 2008 (gmt 0)

10+ Year Member



Hi, thanks for your reply... the heights are important to display a footer image properly and the widths are there because I don't have a wrapper div on this particular page. But maybe i'll add one to make things easier and take out some excess code as you said. That's odd that it works fine for you.. i'm going to test it on different computers and see if I get that problem again. But yeah I was sure all the code was right so the fact you're not getting the problem makes sense.
Thanks!

Dave75

4:30 pm on Apr 2, 2008 (gmt 0)

10+ Year Member



It looks like your mainContent div's borders are squashing the text inside its child div so, mainText div should be width:776px;