Curriculum
Course: CSS Advanced
Login

Curriculum

CSS Advanced

CSS Rounded Corners

0/1

CSS Border Images

0/1

CSS Color Keywords

0/1

CSS Text Effects

0/1

CSS 2D Transforms

0/1

CSS 3D Transforms

0/1

CSS Transitions

0/1

CSS Animations

0/1

CSS Tooltip

0/1

CSS Style Images

0/1

CSS Image Reflection

0/1

CSS Masking

0/1

CSS Buttons

0/1

CSS Multiple Columns

0/1

CSS User Interface

0/1

CSS Box Sizing

0/1

CSS Media Queries

0/1
Text lesson

CSS User Interface

CSS User Interface

This chapter covers the following CSS properties related to user interface:

  • resize
  • outline-offset

Browser Support

The numbers in the table indicate the initial browser version that offers complete support for the property.

IMG_3703

CSS Resizing

The resize property determines whether and how an element can be resized by the user.

Image

In the following example, users are allowed to resize only the width of a <div> element.

Example 

div {
  resize: horizontal;
  overflow: auto;
}

In the following example, users are enabled to resize solely the height of a <div> element.

Example 

div {
  resize: vertical;
  overflow: auto;
}

In the following example, users can resize both the height and width of a <div> element.

Example 

div {
  resize: both;
  overflow: auto;
}

In numerous browsers, the <textarea> element is inherently resizable. Here, we’ve utilized the resize property to deactivate this capability.

 

Example 

textarea {
  resize: none;
}

CSS Outline Offset

The outline-offset property introduces a gap between an outline and the edge or border of an element.

Image

Note: Outlines differ from borders! Unlike borders, outlines are drawn outside the element’s border and may overlap other content. Additionally, outlines do not contribute to the element’s dimensions; thus, the total width and height of the element remain unaffected by the width of the outline.

In the following example, the outline-offset property is employed to create distance between the border and the outline.

Example 

div.ex1 {
  margin: 20px;
  border: 1px solid black;
  outline: 4px solid red;
  outline-offset: 15px;
}

div.ex2 {
  margin: 10px;
  border: 1px solid black;
  outline: 5px dashed blue;
  outline-offset: 5px;
}