Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Css resize min-width

Tags:

css

webkit

resize

I want to make a div resizable with resize css property:

#foo{
  overflow: hidden;
  resize: both;
}

I can freely resize it with firefox.

with chrome/safari I can't resize it smaller than initial size.

their is a way to allow resize smaller with webkit? (min-width / min-height don't works)

see the live exemple from MDN (with 2 nested divs) https://developer.mozilla.org/samples/cssref/resize.html

like image 559
Yukulélé Avatar asked Apr 02 '13 14:04

Yukulélé


2 Answers

Better solution is to use :active pseudo class e.g:

div:active {
  height: 0;
  width: 0;
}

Example: http://jsfiddle.net/kronenbear/v4Lq5o09/1/

like image 126
Dmitry Vasilev Avatar answered Oct 13 '22 04:10

Dmitry Vasilev


There is a small workaround that I found here, but it does work.

On hover, change the height and width to 1px

#foo:hover{
    width: 1px;
    height: 1px;
}

It sounds like this will cause a slight "flash" as the width and height are dramatically changing, but ... it is a hack.

like image 41
What have you tried Avatar answered Oct 13 '22 06:10

What have you tried