CSS Border

Google Advertisements

Prev Tutorial Next Tutorial

CSS Border

The CSS border properties allow you to specify the style, size, and color of an Html element border. Following CSS border properties are used for Html elements,

  • border-style
  • border-width
  • border-color
  • border-radius

Border Style

The border-style property specifies what kind of border to display.

ValueDescription
noneIt is used for does not define any border.
dottedIt is used to define a dotted border.
dashedIt is used to define a dashed border.
solidIt is used to define a solid border.
doubleIt defines two borders with the same border-width value.
grooveIt defines a 3D grooved border. effect is generated according to border-color value.
ridgeIt defines a 3D ridged border. effect is generated according to border-color value.
insetIt defines a 3D inset border. effect is generated according to border-color value.
outsetIt defines a 3D outset border. effect is generated according to border-color value.

Example

<!DOCTYPE html>  
<html>  
<head>  
<style>  
p.none {border-style: none;}  
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.hidden {border-style: hidden;}  
</style>  
</head>  
<body>  
<p class="none">No border.</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="hidden">A hidden border.</p>  
</body>  
</html>

Output

No border.

A dotted border.

A dashed border.

A solid border.

A double border.

A groove border.

A ridge border.

An inset border.

An outset border.

Border Width

The border-width property is used to set the border width. It is set in pixels. You can also set the width of the border by using pre-defined values, thin, medium or thick.

Example: css border-color

<!DOCTYPE html>  
<html>  
<head>  
<style>  
p.para1w {  
    border-style: solid;  
    width:200px;
	border-color: green;  
}  
p.para2w {  
    border-style: solid;  
    width:100px;
    border-color: red;  
}   
</style>  
</head>  
<body>  
<p class="para1w">This is a solid red border</p>  
<p class="para2w">This is a solid green border</p>  
</body>  
</html>

Output

border-radius 50px

border-radius 10px

Border Color

This properties are used for set the color of Html elements border. There are three method to set the color of border.

  • Name: It specifies the color name. For example: "red".
  • RGB: It specifies the RGB value of the color. For example: "rgb(255,0,0)".
  • Hex: It specifies the hex value of the color. For example: "#ff0000".

Example: css border-color

<!DOCTYPE html>  
<html>  
<head>  
<style>  
p.para1 {  
    border-style: solid;  
    border-color: green;  
}  
p.para2 {  
    border-style: solid;  
    border-color: red;  
}   
</style>  
</head>  
<body>  
<p class="para1">This is a solid red border</p>  
<p class="para2">This is a solid green border</p>  
</body>  
</html>

Output

This is a solid red border

This is a solid green border

Border Radius

border-radius are used for give the radius for border, using this you can make a circle.

Example: css border-color

<!DOCTYPE html>  
<html>  
<head>  
<style>  
p.parar1 {  
    border-style: solid;  
    border-radius: 100%;  
    border-color: green;  
}  
p.parar2 {  
    border-style: solid;  
    border-radius: 50%; 
	height:100px;
	width:100px;
    border-color: red;  
}   
</style>  
</head>  
<body>  
<p class="parar1">This is a solid red border</p>  
<p class="parar2">This is a solid green border</p>  
</body>  
</html>

Output

border-radius 50px

border-radius 10px

Browser supported

Properties
borderYesYesYesYesYes

Prev Tutorial Next Tutorial

Google Advertisements

We have more than 5 Groups which have 500000+ Members and some Pages have more than 100000+ members. If you want to post your article on our website/FB Group/FB Page please contact on [email protected] or 8076671483

Buy This Ad Space @$50 per Month, Ad Size 600X200 Contact on: [email protected] or 8076671483

Path variable is set for providing path for all Java tools like java, javac, javap, javah, jar, appletviewer which are used in java programming. All these tools are available in bin folders so we set path upto bin folders.

Classpath variable is set for providing a path for predefined Java classes which is used in our application. All classes are available in lib/rt.jar so we set classpath upto lib/rt.jar.

Cloud computing is the on demand availability of computer system resources, especially data storage and computing power, without direct active management by the user.

College Projects Related to Java, AWT, C Projects for College, C++ Projects for College, Android Projects.

Download Projects

Adsense Advertisements


Buy This ads Space 8076671483

Buy This Ad Space @$120 per Month, Ad Size 300X600 Contact on: [email protected] or 8076671483 Try this Keyword C++ Programs