CSS Borders
Welcome to the CSS Borders tutorial on codeswithpankaj.com
. In this tutorial, we will explore various CSS border properties, including border-style
, border-width
, border-color
, border-radius
, and individual border sides (border-top
, border-right
, border-bottom
, border-left
).
CSS Border Properties
1. border-style
border-style
The border-style
property specifies the style of the border. It can take one of the following values:
none
: No border (default).solid
: A solid border.dashed
: A dashed border.dotted
: A dotted border.double
: A double border.groove
: A 3D grooved border.ridge
: A 3D ridged border.inset
: A 3D inset border.outset
: A 3D outset border.
Example:
HTML:
2. border-width
border-width
The border-width
property specifies the width of the border. It can take specific measurements (e.g., 2px
, 0.5em
) or predefined values (thin
, medium
, thick
).
Example:
HTML:
3. border-color
border-color
The border-color
property specifies the color of the border. It can take color names, HEX values, RGB values, RGBA values, HSL values, and HSLA values.
Example:
HTML:
4. border-radius
border-radius
The border-radius
property specifies the radius of the border's corners. It can be used to create rounded corners.
Example:
HTML:
5. Individual Border Sides
You can specify different border properties for each side of an element using border-top
, border-right
, border-bottom
, and border-left
.
Example:
HTML:
Conclusion
CSS border properties allow you to control the style, width, color, and radius of borders around HTML elements. By mastering these properties, you can create visually appealing and well-defined elements on your web pages. Stay tuned to codeswithpankaj.com
for more tutorials and web development tips!
Last updated