I’m trying to maintain aspect ratio 1:1 on div tag with CSS resize property. Is it possible to do so?
This example has no aspect ratio. Any suggestions?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could make it “resize:horizontal” and then resize the other way with javascript:
markup:
js:
http://jsfiddle.net/valentinas/kFmY8/121/
The problem is that you need to check somehow when the element changes. AFAIK there is no event fired when the element is resized, so you would have to check in intervals to get reliable results. My example observes mousemove, but that is not reliable because you can actually move the mouse out of the element while resizing.