A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/css/properties/border below:

border · WebPlatform Docs

border Summary

Shorthand property that defines the different properties of all four sides of an element’s border in a single declaration. It can be used to set border-width, border-style and border-color, or a subset of these.

Overview table
Initial value
medium none currentColor
Applies to
All elements
Inherited
No
Media
visual
Computed value
concatenation of border-width, border-style, and border-color.
Animatable
Yes
CSS Object Model Property
border
Percentages
N/A
Syntax Values
inherit
When the value is set to inherit, the element will inherit the border values set on its parent.
<border-width> OR <border-style> OR <border-color>
A concatenation of <border-width>, <border-style>, and <border-color>. At least one of these must be present, and they may appear in any order.

<border-width>: A numeric value with any of the standard length units. The initial value is medium, which most browsers will render as 3px. See the border-width property.

<border-style>: This takes any of the range of values available to the border-style property. The initial value is none.

<border-color>: This takes any valid CSS color. See the border-color property. The initial value is currentColor.

Examples

A simple example showing multiple <div>s, identical in style except that they have different border properties applied to them.

<div class="one"><p>One</p></div>
<div class="two"><p>Two</p></div>
<div class="three"><p>Three</p></div>
<div class="four"><p>Four</p></div>
<div class="five"><p>Five</p></div>

View live example



div {
  width: 150px;
  height: 150px;
  margin: 1rem;
  float: left;
}

p {
  padding: 2rem;
}

.one {
  
  border: 1px solid black;
}

.two {
  
  border: 4px dashed;
}

.three {
  
  border: dotted red;
}

.four {
  
  border: 10px black;
}

.five {
  
  border: 10px inset rgba(234,190,50,0.75);
}

View live example

Usage
 * It is usual to first use the border shorthand property to set the state of a default box, and then override it where needed, using the more specific shorthand properties border-width, border-style, and border-color. Each of these properties may take up to four values, respective to the sides of the box.

border-top-width, border-top-style, border-top-color, border-right-width, border-right-style, border-right-color, border-bottom-width, border-bottom-style, border-bottom-color, border-left-width, border-left-style, border-left-color.

Notes Related specifications
CSS Level 3
Candidate Recommendation
CSS Level 2 (Revision 1)
Recommendation
CSS Level 1
Recommendation
See also Related articles Border Box Model Related pages Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4