CSS3 User Interface Box Resize

Use CSS3 resize property to allow end user to resize an element

Creative CSS

Designing with CSS – Box Resize

CSS3 offers some great new properties relating to resizing elements such as text areas, outlining, box sizing, and more. We have already discussed some of these features. In this article and subsequent few more we will focus on some of the most significant ways you can enhance user interface features in CSS3.

The CSS3 resize property allows you to specify whether or not a resizing mechanism on an element is present, and if so, horizontally, vertically or both.

The code for this is very simple:

resize: both;
overflow: auto;
-moz-resize: both;  /* Firefox */
-webkit-resize: both;   /* WebKit */

CSS3 Generator

If you are not very comfortable with CSS, or would like to have CSS codes auto-generated for you to save time, here is a useful and handy tool called CSS3 Generator. This simple tool created by Randy Jensen could be used for most basic design elements like rounder corners, box-shadow, text-shadow, etc on your webpages. It will create some cross-browser CSS3 code based on whatever values you want.

Box Resize

You choose the direction in which the element should be resized. The code will be generated.

Your Code:

resize: both;
overflow: auto;
min-width: 50px; /* suggest a min-width & min-height */
min-height 50px; 

But you must also suggest minimum width and height to avoid making the box too small, and it’s also better to set maximum width and height to avoid breaking your layout completely. The overflow property is set to scroll and the contents should be editable.

Note:
Twitter What’s happening? box has resize height feature. They have set a minimum height but not set maximum height that doesn’t make sense as your message could only be 140 characters long.

If your browser supports CSS3 resize property, I give you below three boxes, which can be resized by the user with a bottom-right handle.

Check it out! Whether it works for you or not, please share with me by writing a comment, and mentioning your browser and version. Your feedback would be immensely helpful.

Examples of CSS3 User Interface Box Resize

Example 1 (Resize: Both)
Allows the box to be resized by the user horizontally and vertically.

CSS Code:

resize: both;
overflow: auto;
CSS3 Box Resize Horizontally and Vertically
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam cursus. Morbi ut mi. Nullam enim leo, egestas id, condimentum at, laoreet mattis, massa. Sed eleifend nonummy diam. Praesent mauris ante, elementum et, bibendum at, posuere sit amet, nibh. Duis tincidunt lectus quis dui viverra vestibulum. Suspendisse vulputate aliquam dui. Nulla elementum dui ut augue. Aliquam vehicula mi at mauris. Maecenas placerat, nisl at consequat rhoncus, sem nunc gravida justo, quis eleifend arcu velit quis lacus. Morbi magna magna, tincidunt a, mattis non, imperdiet vitae, tellus. Sed odio est, auctor ac, sollicitudin in, consequat vitae, orci. Fusce id felis. Vivamus sollicitudin metus eget eros.

Example 2 (Resize: Horizontal)
Allows the box to be resized by the user horizontally only.

CSS Code:

resize: horizontal;
overflow: auto;
CSS3 Box Resize Horizontally
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam cursus. Morbi ut mi. Nullam enim leo, egestas id, condimentum at, laoreet mattis, massa. Sed eleifend nonummy diam. Praesent mauris ante, elementum et, bibendum at, posuere sit amet, nibh. Duis tincidunt lectus quis dui viverra vestibulum. Suspendisse vulputate aliquam dui. Nulla elementum dui ut augue. Aliquam vehicula mi at mauris. Maecenas placerat, nisl at consequat rhoncus, sem nunc gravida justo, quis eleifend arcu velit quis lacus. Morbi magna magna, tincidunt a, mattis non, imperdiet vitae, tellus. Sed odio est, auctor ac, sollicitudin in, consequat vitae, orci. Fusce id felis. Vivamus sollicitudin metus eget eros.

Example 3 (Resize: Vertical )
Allows the box to be resized by the user vertically only.

CSS Code:

resize: vertical;
overflow: auto;
CSS3 Box Resize Vertically
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam cursus. Morbi ut mi. Nullam enim leo, egestas id, condimentum at, laoreet mattis, massa. Sed eleifend nonummy diam. Praesent mauris ante, elementum et, bibendum at, posuere sit amet, nibh. Duis tincidunt lectus quis dui viverra vestibulum. Suspendisse vulputate aliquam dui. Nulla elementum dui ut augue. Aliquam vehicula mi at mauris. Maecenas placerat, nisl at consequat rhoncus, sem nunc gravida justo, quis eleifend arcu velit quis lacus. Morbi magna magna, tincidunt a, mattis non, imperdiet vitae, tellus. Sed odio est, auctor ac, sollicitudin in, consequat vitae, orci. Fusce id felis. Vivamus sollicitudin metus eget eros.
Browser Support
Box resize is currently only supported in Firefox 4.0+ Chrome 4.0+ and Safari 3.1+
CSS3 Generator
W3C CSS3 Basic User Interface Module
This module describes selectors and CSS properties which enable authors to style user interface related states, element fragments, properties and values.
CSS3 Box Resize Property
Web Host for your WordPress Blog
If you are looking for a web host that will provide hosting environment for WordPress, BlueHost is one of the best choices. My website and blog are hosted by BlueHost.
Click Here to Signup for BlueHost
Small Business Website Design
Get a professionally designed special custom five-page website ideal for small business that need an online presence as well as personal sites or informational sites at an amazing price of only $125.
Visit our website to learn more about Small Business Website Design

CSS3 Box with Multiple Columns
Create multiple columns with CSS3 column-count and column-gap properties
More CSS3
 
Related Posts with Thumbnails
Admin/Author Admin/Author: Subrato Paul, owner of GoldenTwine Informatics founded in April 2003, lives in Kolkata, India. He is a freelance website designer, Internet marketer, social media enthusiast, and blogger. He writes in his blogs and as a guest writer about marketing and social media, eCommerce, website design and development, and his website.
RSSDid you like this article? If you're new to goldenTwine blog, you may want to
Subscribe to RSS feed: | Comments RSS | Email Subscription
Social Media:
Short Link: https://wp.me/pPMoR-py | Thanks for visiting!

Post a Comment

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*
*

Notify me of followup comments via e-mail. You can also subscribe without commenting.

This site uses Akismet to reduce spam. Learn how your comment data is processed.