CSS HTML Javascript jQuery Ajax PHP Example Java MORE
Need a Website Or Web Application Contact : +91 9437911966 (Whatsapp) Note: Paid Service

CSS Border

CSS Background

The CSS border is used to set a border for an HTML element. The CSS border specifying the style, color, size of the border.

The CSS border properties are given below

  1. border-style
  2. border-color
  3. border-width
  4. border-radius

CSS Border Style:

The CSS border-style properties is used to define which type of border we want to show in the webpage.

In CSS there are various value for border-style properties:

Value Description
none It doesn't define any border.
dotted It is used to define a dotted border.
dashed It is used to define a dashed border.
solid It is used to define a solid border.
double It defines two borders wIth the same border-width value.
groove It defines a 3d grooved border. effect is generated according to border-color value.
ridge It defines a 3d ridged border. effect is generated according to border-color value.
inset It defines a 3d inset border. effect is generated according to border-color value.
outset It defines a 3d outset border. effect is generated according to border-color value.

Example:

<!DOCTYPE html>
<html>
<head>
<style>
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: dotted dashed solid double;}
</style>
</head>
<body>
 
     <h2>The border-style Property</h2>
    <p>This property specifies what kind of border to display:</p>
    <p class="dotted">A dotted border.</p>
    <p class="dashed">A dashed border.</p>
    <p class="solid">A solid border.</p>
    <p class="double">A double border.</p>
    <p class="groove">A groove border.</p>
    <p class="ridge">A ridge border.</p>
    <p class="inset">An inset border.</p>
    <p class="outset">An outset border.</p>
    <p class="none">No border.</p>
    <p class="hidden">A hidden border.</p>
    <p class="mix">A mixed border.</p>
 
</body>
</html>


Run it yourself

CSS Border Color

The CSS border color is used to set color for the border.

Example:

<!DOCTYPE html>
<html>
<head>
<style>
p.dotted {border-style: dotted;color:green;}
p.dashed {border-style: dashed;color:green;}
p.solid {border-style: solid;color:red;}
p.double {border-style: double;color:green;}
</style>
</head>
<body>
  <h2>The border-style Property with color</h2>
    <p>This property specifies what kind of border to display with color:</p>
    <p class="dotted">A dotted border.</p>
    <p class="dashed">A dashed border.</p>
    <p class="solid">A solid border.</p>
    <p class="double">A double border.</p>
 </body>
</html>


Run it yourself