How to fit contents in div tag using css

How to fit contents in DIV tag using css.
Well, I have DIV tag in the web page, but I want the text written in that DIV tag will fit into it using something like padding so that it will look better.

But I am not able to do this, because, the text is going out of the DIV.
I don’t know what to do.

I wrote,

#left-sidebar {
  width:15%;
  float:left;
  font-size:13pt;
  padding: 2px;
}

With that code alone the text will not flow outside of the div. There will be something else causing this, so please post more code, or post a link.

Give text align left of justify, contents will align into the div. Give fixed size into the div. With the use any of the tag we can overcome that problem.

Hi,

Please check that the content is enclosed by the correct “<div> and </div>” and make sure about the wrapper div also. because it will take the width of 15% from the wrapper div only.

try it!