Border properties draw different line styles around elements.

border-color, border-style, border-width

To display a border around an HTML element you have to define the fallowing properties: border-color, border-style, border-width.

border-color

The border-color property sets the color of the border.
  - Values: You can also set the border color to "transparent".
  - Syntax:

The "border-color" does not work if it is used alone. You need to use the "border-style" property to set the borders first.


• You can also set individual border color values for each side, with the fallowing properties:

border-style

The border-style property specifies what kind of border to display. You can define one of the fallowing values: - none specifies no border. In the image below you can see the effect of the other values:
css border-style
  - Syntax:
• You can also set individual border style values for each side, with the fallowing properties:

border-width

The border-width sets the size of the border.
The value of this property is set in pixels, or by one of the three pre-defined values: thin, medium, or thick.
  - Syntax:
• You can also set individual border width values for each side, with the fallowing properties:
  Example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
 <title>border</title>
 <style type="text/css"><!--
 #idd {
  border-style: outset;
  border-width: 3px;
  border-color: blue;
 }
 --></style>
</head>
<body>
 <div id="idd">Free Web Development courses and resources.</div>
</body>
</html>
  - Result:
Free Web Development courses and resources

border

Using the border property you can shorten the code. It accept three values representing border-width, border-style, and border-color.
  - Syntax:
The CSS code from the above example can be rewritten like this (the effect is the same):
#idd { border: 3px outset blue; }

• You can also set border shorthand property values for each side, with the fallowing syntaxes:
  Example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
 <title>border shorthand</title>
 <style type="text/css"><!--
 #idd {
  border-left: 4px outset red;
  border-right: 4px outset green;
  border-bottom: 2px dashed blue;
 }
 --></style>
</head>
<body>
 <div id="idd">CSS online course, free lessons.</div>
</body>
</html>
  - Result:
CSS online course, free lessons.

Annul /Remove border

To annul /remove border, use the none value.
In the following example it is set a border for all margins, then it is removed the bottom border.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
 <title>border shorthand</title>
 <style type="text/css"><!--
 #idd {
  border: 2px solid blue;
  border-bottom: none;
 }
 --></style>
</head>
<body>
 <div id="idd">CSS online course, free lessons.</div>
</body>
</html>
  - Result:
CSS online course, free lessons.

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
Which tag defines the clickable areas inside the image map?
<map> <img> <area>
<img src="image.jpg" usemap="#map1">
<map name="map1">
  <area shape="rect" coords="9, 120, 56, 149" href="#">
  <area shape="rect" coords="100, 200, 156, 249" href="#">
</map>
Which CSS property defines what is done if the content in a box is too big for its defined space?
display overflow position
#id {
  overflow: auto;
}
Click on the event which is triggered when the mouse is positioned over an object.
onclick onmouseover onmouseout
document.getElementById("id").onmouseover = function(){
  document.write("Have Good Life");
}
Indicate the PHP variable that contains data added in URL address after the "?" character.
$_SESSION $_GET $_POST
if(isset($_GET["id"])) {
  echo $_GET["id"];
}
CSS Border

Last accessed pages

  1. CSS Border (4663)
  2. innerHTML in PHP (3747)
  3. Add and Remove HTML elements and Content with jQuery (17347)
  4. CSS cursor property - Custom Cursors (3102)
  5. Remove / Get duplicate array values - Reset array keys in PHP (5853)

Top accessed pages

  1. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (45592)
  2. Read Excel file data in PHP - PhpExcelReader (34306)
  3. PHP-MySQL free course, online tutorials PHP MySQL code (34225)
  4. Get Attribute (ID, Class, Name, Title, Src) with jQuery (30806)
  5. PHP PDO - exec (INSERT, UPDATE, DELETE) MySQL (28062)