CSS Border properties draw different line styles around HTML elements.
To display a border around a HTML element you have to define the fallowing properties: border-color, border-style, border-width.
The border-color
property sets the color of the border.
The 'border-color' does not work if it is used alone. You need to use the 'border-style' property to set the borders first.
The border-style
property specifies what kind of border to display. You can define one of the fallowing values.
none
specifies no border.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.
<style> #idd { border-style: outset; border-width: 3px; border-color: blue; padding:3px; } </style> <h4>Example CSS border-style, border-width, border-color</h4> <div id='idd'>Free Web Development courses and resources.</div>
Using the border
property you can shorten the code. It accept three values representing border-width, border-style, and border-color.
<style> #idd { border-left: 4px outset red; border-right: 4px outset green; border-bottom: 2px dashed blue; padding:3px; } </style> <h4>Example border-left, border-right, border-bottom</h4> <div id='idd'>If the life is a dream, where and who is the dreamer?</div>
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.
<style> #idd { border: 2px solid blue; border-bottom: none; padding:3px; } </style> <h4>Example css border property</h4> <div id='idd'>Wake Up the Truth.</div>
<input type="text" name="a_name" value="val" />
h3 { font-variant: small-caps; }
var msg = "Visit CoursesWeb.net"; alert(msg);
$ip = $_SERVER["REMOTE_ADDR"]; echo $ip;