html css outline,CSS Outline

Outlines are special visual properties similar to border, but take up no space in the layout. They will highlight an item without shifting its position.

An outline is a line that is drawn around elements, outside the border edge, to make the element 'stand out'. It specifies the style, color, and width of an outline, but don't have separate definitions for each of the four sides.

CSS outline-color

The outline-color property sets the color of an outline.

- Values:

invert - Makes a color inversion. This ensures that the outline is visible, regardless of color background (default).

name - specify a color name (blue, green, ...).

RGB - specify a RGB value, like 'rgb(10,20,250)'.

Hex - A hex value (#0101ff , #a8feb8).

- Syntax:

outline-color: value;

The outline-color does not work if it is used alone. You need to define the 'outline-style' property before the 'outline-color'.

CSS outline-style

The outline-style property specifies what kind of line to display. You can define one of the fallowing values.

none, solid, dashed, dotted, double, groove, ridge, inset, outset

- none specifies no outline. In the image below you can see the effect of the other values:

border-style.gif

- Syntax:

outline-style: value;

CSS outline-width

The outline-width sets the size of the border.

- Values:

length - A pixel (px) value that defines the thickness of the outline.

thin - A thin outline.

medium - A medium outline (default).

thick - Specifies a thick outline.

- Syntax:

outline-width: value;

Example:

#idd {

outline-style: dashed;

outline-width: 2px;

outline-color: blue;

padding:3px;

}

Example CSS outline
Free Web Development courses and resources.

outline shorthand

Using the CSS outline shorthand property you can shorten the code. It accept three values representing outline-width, outline-style, and outline-color.

- Syntax:

selector { outline: width_val style_val color_val; }

The CSS code from the above example can be rewritten like this (the effect is the same):

#idd { outline: 2px dashed blue; }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值