简体   繁体   中英

How to resize div element less than its content?

I have a table and there is a TreeView in a cell. Here is my code:

   <style>
        #leftPanel
        {
            width:60px;
            height:'100%';
            border:1px solid red;
            background:yellow;
        }  
    <style>

        <table>
         <tr>
          <td> 
           <div id="leftPanel">
             <asp:PlaceHolder runat="server" ID="TreeView" />
             <%-- Here is a TreeView --%>
           </div>
          </td>
         </tr>
          <%-- other code --%>
        <table>

 $(function () {
         $('#leftPanel').resizable(
         {
             handles: 'e, w'
         });
     });

I can't reduce the size of my div less then the size of my TreeView. What code need I write to allow leftPanel to be less than the size of TreeView ? It is necessary if TreeView node's text too long.

You can set the overflow property for the div in CSS.

Set it to overflow: auto;

DEMO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM