WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

CSS Borders


CSS Border Properties

The CSS outskirt property enables you to alter the fringes of HTML components. So as to add an outskirt to the component, you have to indicate the size, style, and shade of the fringe. The precedent underneath tells the best way to add a strong green outskirt to the paragraph.


Border Style

The border-style property utilized for change style

The following qualities are allowed:

  • dotted - It is a specked border
  • dashed - It is a dashed border
  • solid - It is a strong border
  • double - It is a twofold border
  • groove - It is a 3D scored fringe. The impact relies upon the fringe shading value
  • ridge - It is a 3D furrowed fringe. The impact relies upon the fringe shading value
  • inset - It is a 3D inset fringe. The impact relies upon the fringe shading value
  • outset - It is a 3D beginning fringe. The impact relies upon the fringe shading value
  • none - It is no border
  • hidden - It is a concealed border

There are different styles upheld for the border-style property spotted, dashed, double.

Example

p.dotted {border-style: dotted;}
p.dashed {border-style: dashed;}
p.solid {border-style: solid;}
p.double {border-style: double;}
p.groove {border-style: groove;}
p.ridge {border-style: ridge;}
p.inset {border-style: inset;}
p.outset {border-style: outset;}
p.none {border-style: none;}
p.hidden {border-style: hidden;}
p.mix {border-style: spotted dashed strong double;}

Result:

A strong border.

A twofold border.

A groove outskirt. The impact relies upon the fringe shading value.

A edge fringe. The impact relies upon the fringe shading value.

An inset fringe. The impact relies upon the fringe shading value.

An beginning fringe. The impact relies upon the outskirt shading value.

No border.

A dabbed border.

A dashed border.

A concealed border.

mixed border.

Try it yourself »

Border Width

The border-width property indicates the width of the fringe. .

The width can be set as a depict size, for example, px, pt, cm, em and so on:

The border-width property have four qualities, for example, the best fringe, right outskirt, base fringe, and the left border.

Example

p.first {
    fringe style: double;
    fringe width: 5px;
}

p.second {
    fringe style: solid;
    fringe width: medium;
}

p.third {
    fringe style: dashed;
    fringe width: 2px 10px 4px 20px;
}
Try it yourself »

Border Color

The border-color The fringe shade of the component can be defined.

The shading can be set :

  • name - characterize a shading name, as "red"
  • Hex - characterize a hex esteem, as "#ff0000"
  • RGB - characterize a RGB esteem, as "rgb(255,0,0)"
  • transparent

Example

p.first {
    fringe style: solid;
    fringe shading: : #9bf442;
}

p.second {
    fringe style: #f4a041;
    fringe shading: #f44194 #41eef4 #79f441;
}

p.third {
    fringe style: solid;
    fringe shading: red green blue yellow;
}
Try it yourself »

Border - Individual Sides

You can look models over that it is conceivable to characterize a distinctive fringe for each side.

In CSS, there is additionally properties for characterize every one of the outskirts top, right, base, and left:

Example

p {
    fringe top-style: dotted;
    fringe right-style: solid;
    fringe base style: dotted;
    fringe left-style: solid;
}
Try it yourself »

The model above gives indistinguishable outcome from this:

Example

p {
    outskirt style: dabbed solid;
}
Try it yourself »

This is case of what to look like work:

If the border-style property has four values:

  • border-style: spotted strong twofold dashed;
    • top outskirt is dotted
    • right outskirt is solid
    • bottom outskirt is double
    • left outskirt is dashed

If the border-style property has three values:

  • border-style: spotted strong double;
    • top outskirt is dotted
    • right and left outskirts are solid
    • bottom fringe is double

If the border-style property has two values:

  • border-style: dabbed solid;
    • top and base fringes are dotted
    • right and left fringes are solid

If the border-style property has one value:

  • border-style: dotted;
    • all four fringes are dotted

The border-style property is utilized in the model above. In any case, it additionally works with border-width furthermore, border-color.


Border - Shorthand Property

You can look from the models above, there are numerous properties to think about when managing borders.

To abbreviate the code, it is additionally conceivable to determine all the individual outskirt properties in one property.

The border property is a shorthand property for the accompanying individual outskirt properties:

  • border-width
  • border-style (required)
  • border-color

Example

p {
    outskirt: 5px strong #9bf442;
}
Try it yourself »