 		if vp.layer_pos.width < 10 or vp.layer_pos.height < 10
 			console.warn("Layer: DIM is very small, layer might not be visible. Placement:", placement, "Dimensions:", vp, "Layer:", @__layer.DOM)
 
+		if @_element and @_use_element_width_as_min_width
+			minWidth = dim_element.borderBoxWidth
+		else
+			minWidth = undefined
+
 		# set layer
 		CUI.DOM.setStyle @__layer.DOM,
 			top: vp.layer_pos.top
 			left: vp.layer_pos.left
-			width: if vp.set_width then vp.layer_pos.width else ""
+			width: vp.layer_pos.width
 			height: vp.layer_pos.height
+			minWidth: minWidth
 			# maxWidth: vp.width + vp.overlap_width
 			# maxHeight: vp.height + vp.overlap_height
 			margin: 0

		if @__element
			dim_element = CUI.DOM.getDimensions(@__element)

			if @_use_element_width_as_min_width
				dim_layer.borderBoxWidth = Math.max(dim_layer.borderBoxWidth, dim_element.borderBoxWidth)

		else if @_show_at_position
			dim_element =
				viewportTop: @_show_at_position.top

			layer_pos = vp.layer_pos = {}
			pointer_pos = vp.pointer_pos = {}

			# number of times we need to cut the layer
			# to make it fit into the viewport
			vp.cuts = 0
