1

hope you can help me with my problem.

I have a div that is absolutly positioned (this can not be changed). This div has a maximum and minimum width.

Want i want to achieve is that the div stretch to its content and only when it overpases the width, start with a new line.

HTML:

<div class="black_tooltip_container ">
    some text in here, it can be anything!
</div>

CSS:

position:absolute; min-width:10px; max-width:150px;

What i see:

 _____________
  | some      |
  | text      |
  | in        |
  | here,     |
  | it        |
  | can       |
  | be        |
  | anything! |
  _____________

What i want to see:

          width: 150px
  _______________________________
  | some text   in here, it can |
  | be anything!                |
  ______________________________

EDIT: Issue solved. The problem was that I didn't realize the div was nested very far away in a div that was with relative position and width:50px;

After removing it from it's parent, it worked as spected

4

1 回答 1

1

你有什么应该工作:

<div class="black_tooltip_container ">
    some text in here, it can be anything!
</div>

.black_tooltip_container {
    border:1px solid;
    min-width:10px; 
    max-width:150px;
    position:absolute;
}

在这里看到它:

http://jsfiddle.net/nbHMY/

于 2013-03-21T21:52:11.040 回答