Dotted border"/> Dotted border">
Home > Article > Web Front-end > How to set a dotted line in html
Steps to create dashed lines in HTML: Set the border style to dashed. Set the border width. Optional: Set border color. Sample code:
Dash border
Steps to create dotted lines in HTML
1. Set the border style
Use CSS'sborder-style
Property applies a dashed style to an element. The value for dashed style is dashed
.
<code class="html">element { border-style: dashed; }</code>
2. Set the border width
Use the border-width
property to set the width of the dashed line.
<code class="html">element { border-width: 1px; }</code>
3. Set the border color (optional)
Use the border-color
property to set the color of the dotted line.
<code class="html">element { border-color: #FF0000; /* 红色虚线 */ } </code>
Sample Code
The following code will create a 1 pixel wide red dashed border:
<code class="html"><div style="border-style: dashed; border-width: 1px; border-color: #FF0000;"> 虚线边框 </div></code>
The above is the detailed content of How to set a dotted line in html. For more information, please follow other related articles on the PHP Chinese website!