CSS3 User Interface


CSS3 User Interface

In CSS3, some new user interface features have been added to adjust element size, box sizing, and outlines.

In this chapter, you will learn about the following user interface properties:

  • resize
  • box-sizing
  • outline-offset

Browser Support

The numbers in the table indicate the first browser version number that supports the property.

The number immediately preceding -webkit-, -ms-, or -moz- is the first browser version number that supports the prefixed property.

Property
resize 4.0 79.0 5.0
4.0 -moz-
4.0 15.0
box-sizing 10.0
4.0 -webkit-
8.0 29.0
2.0 -moz-
5.1
3.1 -webkit-
9.5
outline-offset 4.0 15.0 5.0
4.0 -moz-
4.0 9.5

CSS3 Resizing

In CSS3, the resize property specifies whether an element should be resized by the user.

This div element is resized by the user. (In Firefox 4+, Chrome, and Safari)

The CSS code is as follows:

OperaSafariChromeFirefoxInternet Explorer

Example

The user specifies the size of a div element:

div { resize:both; overflow:auto; }

Try it Yourself »


CSS3 Box Sizing

The box-sizing property allows you to define specific content in an exact way to fit an area.

OperaSafariChromeFirefoxInternet Explorer

Example

Specify two side-by-side bordered boxes:

div { box-sizing:border-box; -moz-box-sizing:border-box; /* Firefox */ width:50%; float:left; }

Try it Yourself »


CSS3 outline styling (outline-offset)

The outline-offset property offsets the outline and draws it beyond the border edge.

There are two differences between outlines and borders:

  • Outline takes up no space
  • Outlines may be non-rectangular
This div has an outline 15 pixels outside the border.

The CSS code is as follows:

OperaSafariChromeFirefoxInternet Explorer

Example

Specifies an outline 15 pixels outside the border edge:

div { border:2px solid black; outline:2px solid red; outline-offset:15px; }

Try it Yourself »


New user interface features

Property Description CSS
appearance Allows you to make an element look like a standard user interface element 3
box-sizing Allows you to define certain elements in a way that fits the area 3
icon Provides creators with the ability to set elements as icon equivalents. 3
nav-down Specifies where to navigate when using the arrow-down navigation key 3
nav-index Specify the tab order of an element 3
nav-left Specifies where to navigate using the left arrow navigation key 3
nav-right Specifies where to navigate using the right arrow navigation key 3
nav-up Specifies where to navigate when using the arrow-up navigation key 3
outline-offset Outline is modified and drawn beyond the border edge 3
resize Specifies whether an element is resized by the user 3
other extensions