Jstree: constraint width

I have jstree with several subtrees on the page and you want to display something when selecting a branch. The displayed text should appear next to the tree, but for some reason jstree takes up all the space in the div, so the text div is placed under it. The tree and div should be relative to the encapsulating div and float on the left.

Is there a way to compress the width of the tree (setting style = "width = 100px" on the div tree does not work)? Or another way to place text next to a tree without having it absolute?

+6
html css jstree
source share
3 answers

You need to create a DIV that wraps jstree-DIV, something like this:

<div id="wrap"> <div id="jstree"> // Here you have your tree </div> </div> 

Now set the CSS overflow property of the shell to automatic and set the maximum size:

 #wrap { width: 200px; height: 400px; overflow: auto; } 
+2
source share

use max-width. For example. max width: 100px; set the maximum width to 100 pixels.

+1
source share

Well, it seems to me that I should live with this problem and change my layout.

-one
source share

All Articles