Sharp Tutorial
Border in CSS

Python

Java

C

C++

HTML/CSS

Java Script

PHP

SQL

C Programs

HTML

  • HTML Home
  • Introduction
  • HTML Element
  • Commonly used tags
  • Hyperlinks
  • Images in HTML
  • Div in HTML
  • Html Forms
  • Html Tables
  • Miscellaneous Topics

CSS

  • Introduction to CSS
  • How to apply CSS
  • CSS Selectors
  • Border in CSS
  • Text Formatting in CSS
  • Font Properties
  • Margin in CSS
  • CSS in List
  • CSS in Link
  • CSS Animation
  • CSS Effects
  • CSS Pagination
  • CSS Media Query

Java Script

  • Java Script Home
  • Introduction to Java Script
  • Variable in Java Script
  • Operators in Java Script
  • If-Else in Java Script
  • Loops in Java Script
  • Array in Java Script
  • Function in Java Script
  • Objects in Java Script
  • Java Script DOM

Border in CSS

Border is one of the property which allows us to specify style, width and color of an element’s border.

For eg:

This block or element contains border on all sides.

This block or element contains border bottom which is of blue color.

We can also make the borders rounded by Border radius.

This element have green border on left side.

Types of Borders in CSS

  1. Dotted
  2. Solid
  3. None
  4. Double

This is an example of dotted border. To make dotted border of an element we need to define like this: <div style=”border-style:dotted;”>. 

This is an example of solid border. To make dotted border of an element we need to define like this: <div style=”border-style:solid;”>. 

This is an example of none border. To make dotted border of an element we need to define like this: <div style=”border-style:none;”>. 

This is an example of double border. To make dotted border of an element we need to define like this: <div style=”border-style:double;”>. 

We can also increase the width of border by giving this command:

<div style=”border-width:5px;”>.

As we have seen above that we can give any color to the border of an element. Command to change the color of an element is <div style=”border-color:blue;”>

We can also create multicolor border of an element

<div style=”border-color: red green yellow blue;”> 

 

CSS Code implementation Example

<!DOCTYPE>
<html>
<body>
<div style="border-color:red;border-style:dotted;">
<p>This is an example of dotted border</p>
</div>
<br>
<div style="border-color:black;border-style:solid;">
<p>This is an example of solid border</p>
</div>
<br>
<div style="border-color:black;border-style:none;">
<p>This is an example of none border</p>
</div>
<br>
<div style="border-color:black;border-style:double;">

<p>This is an example of double border</p>
</div>
<br>
<div style="border-color:blue;border-style:solid;border-width:5px;">
<p>This is an example to increase the width of border of an element</p>
</div>
<br>
<div style="border-color:red green yellow blue;border-style:solid;">
<p>This is an example of multicolor border</p>
</div>
</body>
</html>

Output of the above program is shown below

Enquiry about Course

Ask your Question

Click Here

Sharp (2) Tutorials

Video/ C Introduction

Watch video in full size

Video tutorial

Follow by Email
Facebook
Facebook
fb-share-icon
YouTube
Copyright © Sharp Tutorial
Build with WordPress
Wordpress Social Share Plugin powered by Ultimatelysocial
Sharp Tutorial