
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.
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.
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;
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;
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;
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.
Box resize is currently only supported in Firefox 4.0+ Chrome 4.0+ and Safari 3.1+
CSS3 Generator
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
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
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
Create multiple columns with CSS3 column-count and column-gap properties
