Monday 12 October 2015

CSS3 User Interface

CSS3 User Interface

In CSS3, some of the new user interface features are resizing elements, box sizing, and outlining.
In this chapter you will learn about the following user interface properties:
  • resize
  • box-sizing
  • outline-offset


Browser Support

PropertyBrowser Support
resize
box-sizing-moz--webkit--webkit-
outline-offset
The resize property is only supported in Chrome and Safari.
The box-sizing is supported in Internet Explorer and Opera. Firefox requires the prefix -moz-. Chrome and Safari require the prefix -webkit-.
The outline property is supported in all major browsers, except Internet Explorer.

CSS3 Resizing

In CSS3, the resize property specifies whether or not an element should be resizable by the user.
This div element is resizable by the user (in Google Chrome and Safari).
The CSS code is as follows:
SafariChromeInternet Explorer

Example

Specify that a div element should be resizable by the user:
div
{
resize:both;
overflow:auto;
}

Try it yourself »


CSS3 Box Sizing

The box-sizing property allows you to define certain elements to fit an area in a certain way:
OperaSafariChromeFirefox

Example

Specify two bordered boxes side by side:
div
{
box-sizing:border-box;
-moz-box-sizing:border-box; /* Firefox */
-webkit-box-sizing:border-box; /* Safari and Chrome */
width:50%;
float:left;
}

Try it yourself »


CSS3 Outline Offset

The outline-offset property offsets an outline, and draws it beyond the border edge.
Outlines differ from borders in two ways:
  • Outlines do not take up space
  • Outlines may be non-rectangular
This div has an outline 15px outside the border edge.
The CSS code is as follows:
OperaSafariChromeFirefoxInternet Explorer

Example

Specify an outline 15px outside the border edge:
div
{
border:2px solid black;
outline:2px solid red;
outline-offset:15px;
}

Try it yourself »


New User-interface Properties

PropertyDescriptionCSS
appearanceAllows you to make an element look like a standard user interface element3
box-sizingAllows you to define certain elements to fit an area in a certain way3
iconProvides the author the ability to style an element with an iconic equivalent3
nav-downSpecifies where to navigate when using the arrow-down navigation key3
nav-indexSpecifies the tabbing order for an element3
nav-leftSpecifies where to navigate when using the arrow-left navigation key3
nav-rightSpecifies where to navigate when using the arrow-right navigation key3
nav-upSpecifies where to navigate when using the arrow-up navigation key3
outline-offsetOffsets an outline, and draws it beyond the border edge3
resizeSpecifies whether or not an element is resizable by the user3

No comments:

Post a Comment