i have the textarea..

<textarea name='content' id='content'   wrap='soft' style='background-image: url(\"frontinput.jpg\");color: #000000;font-size:12px;font-family:Arial;width:445px; height:77px;border:none; padding:5px;'></textarea>

when i display in the div.. the text doesn't fill up the div. the text goes 75% of the way and then line breaks.

here is the css for the div.

.message {
float:left;
width:98%;
background-color:#EFEFEF;
border: 1px solid black;
padding:4px;
overflow:auto;
margin-left:3px;
min-height:120px;


}

How do i get the text to go to the end of the div and then line break?

Recommended Answers

All 4 Replies

try using the heigt constraint and also pixel(px) in width instead of " % "

Looking at your CSS code

.message {
float:left;
width:98%;
background-color:#EFEFEF;
border: 1px solid black;
padding:4px;
overflow:auto;
margin-left:3px;
min-height:120px;


}

You have told the div to make more space than you anticipated I think.

You have the text at 98%, so it is already taking up less of the space.

You have padding, giving even more space around the text, I am not sure if you have tried different values for that yet.

and, you have it 3px from the 4px padding you set for the margin.

Maybe try removing the width percentage, since you already have space with the padding. Its the only thing I can see looking at the code off hand.

commented: Good Eye :) +1

OH I just looked at your HTML code too - you have another padding statement in that, adding to the extra space around your text. Take out the padding from the HTML code since the CSS will take care of that, if you need it.

remember, inline styles take top priority, then embedded styles and then finally external styles. If you have a margin styles with 5 px, then have the same margin styled again, the inline style will be the one that is used. Take out all margin styles in your page and your css page. I have made it a habit of anytime I create a style, whether embedded or external, to set all margins and paddings to "0" first. Then when you need to change either one, you can. It's like starting with a blank canvas, but making sure the canvas is clean so that your painting will start off right.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.