Shrink DIV to text that's wrapped to its max-width?

前端 未结 3 1504
耶瑟儿~
耶瑟儿~ 2020-11-29 11:11

Shrink wrapping a div to some text is pretty straightforward. But if the text wraps to a second line (or more) due to a max-width (as an example) then the size of the DIV do

3条回答
  •  悲哀的现实
    2020-11-29 11:47

    I guess this is what you are thinking about, it can be done in css:

    div {
        border: black solid thin;
        max-width: 100px;
        overflow: auto;
    }
    

    You can see it here: http://jsfiddle.net/5epS4/

提交回复
热议问题