Using CSS to resize a <div> to a dimension smaller than its current width and height
I currently have a div whose css looks like this:
.class
{开发者_如何学Go
overflow:auto;
resize: both;
width: 100px;
height: 100px;
}
I want the user to be able to resize the div so that the resulting width and height can be less than 100px. How is this possible?
EDIT: Some context. I want this feature because I am developing an application where a user can resize a widget and saves this width and height to a server so that the size is saved across sessions. As it is currently setup, when the user stops resizing, my code resets the div's width and height properties dynamically. It works great if the user is making the div larger. However the user cannot then make the div any smaller.
EDIT2: I am using GWT to develop this application. More specifically, this div is just an AbsolutePanel.
The question is a little vague, can't you just make the panel a LayoutPanel?
Get/set the height and width with the Style methods of the DOM client package. Specifically, getHeight(), setHeight(), getWidth(), and setWidth().
You might need to look at a javascript solution (jquery-ui has some nice libraries like http://jqueryui.com/demos/resizable/) to allow the user to resize screen elements.
Otherwise, change your values to percentages (instead of pixels) and let the user resize their window to resize the element (joking, although that would work, technically)
精彩评论