How to set a dotted border in html

How to set a dotted border in html

Use CSS styles and HTML tag elements

In order to add dotted borders to different HTML tags, we select several commonly used tags to align and set the dotted border effect.

1. Commonly used tags in HTML

p tag

span

ul li

table tr td

2. Examples of CSS property words used

border

width

height

3. Key points of implementing dotted lines with CSS

border is a border attribute. If you want to achieve an object border effect, you need to set the border width, border color, and border style (solid line or dotted line)

border:1px dashed #F00 This sets the border style width to 1px, dotted line, and the dotted line is red.

4. Example description

We set the same width, height and border effect for the above labels.

5. Complete HTML code:

  1. <!DOCTYPE html> <html>
  2. <head> <meta charset="utf-8" />
  3. <title>html border dotted line demonstration www.pcss5.com</title> <style>
  4. .bor{border:1px dashed #F00;width:300px;height:60px;margin-top:10px} span{display:block}/*css comment: let span form a block*/
  5. </style> </head>
  6. <body> <p class="bor">p box</p>
  7. <span class="bor">span box</span> <ul class="bor">
  8. <li>ul li list</li> <li>ul li list</li>
  9. </ul> <table class="bor">
  10. <tr> <td>Table</td>
  11. <td>Table 2</td> </tr>
  12. <tr> <td>Data</td>
  13. <td>Data 2</td> </tr>
  14. </table> </body>
  15. </html>

The above example sets the same style for different tags in HTML, including the same border dashed line.

6. Browser effect screenshots

Screenshot of setting border dashed line effect for different tags in html

<<:  Understanding and example code of Vue default slot

>>:  CSS makes the child container exceed the parent element (the child container floats in the parent container)

Recommend

One sql statement completes MySQL deduplication and keeps one

A few days ago, when I was working on a requireme...

Vue implements scrollable pop-up window effect

This article shares the specific code of Vue to a...

Detailed tutorial on installing MariaDB on CentOS 8

MariaDB database management system is a branch of...

Example code for implementing ellipse trajectory rotation using CSS3

Recently, the following effects need to be achiev...

A brief discussion on JS regular RegExp object

Table of contents 1. RegExp object 2. Grammar 2.1...

Podman boots up the container automatically and compares it with Docker

Table of contents 1. Introduction to podman 2. Ad...

CSS3 realizes the effect of triangle continuous enlargement

1. CSS3 triangle continues to zoom in special eff...

Detailed explanation of monitoring NVIDIA GPU usage under Linux

When using TensorFlow for deep learning, insuffic...

Basic commands for MySQL database operations

1. Create a database: create data data _name; Two...

Summary of some problems encountered when integrating echarts with vue.js

Preface I'm currently working on the data ana...

Detailed explanation of Truncate usage in MYSQL

This article guide: There are two ways to delete ...