Home >Web Front-end >CSS Tutorial >How to set border size in css
In CSS, use the border-width property to set the border size. The available units are px, em, pt, cm or %. You can set a uniform width for all borders, or set the width individually for specific borders.
CSS Setting Border Size
Setting border size in CSS is a simple process that requires usingborder-width
attribute. The value of this property can be in the following units:
To set the width of all borders, you can use the border-width attribute, followed by A border size value, such as:
<code class="css">border-width: 2px;</code>
To set the width of a specific border individually, you can use border-top-width
, border-right-width
, border-bottom-width
and border-left-width
attributes, and add a border size value after them, such as:
<code class="css">border-top-width: 10px; border-right-width: 5px; border-bottom-width: 2px; border-left-width: 8px;</code>
Example:
The following CSS code sets the element's border size to 5 pixels:
<code class="css">div { border-width: 5px; }</code>
The following CSS code sets the element's top border size to 10 pixels and the right border size to 5 pixels, Set the bottom border size to 2 pixels and the left border size to 8 pixels:
<code class="css">div { border-top-width: 10px; border-right-width: 5px; border-bottom-width: 2px; border-left-width: 8px; }</code>
The above is the detailed content of How to set border size in css. For more information, please follow other related articles on the PHP Chinese website!