How to use css to generate controllable dotted lines

王林
Release: 2020-04-27 09:05:40
forward
2140 people have browsed it

How to use css to generate controllable dotted lines

Purpose:

Generate a dotted line as shown below

How to use css to generate controllable dotted lines

## Implementation method

Implementation method, some people use multiple spans to generate, a small dot is a span, this is OK, but the entire state change is more troublesome, is there any way to generate a controllable dotted line? Woolen cloth?

(Video tutorial recommendation:

css video tutorial)

Generate dashed

Generate horizontal line

Generating dashed dashed lines is generally achieved through linear-gradient background-size. The implementation code is as follows:

height: 2px; background: linear-gradient(to right, #000000, #000000 7.5px, transparent 7.5px, transparent); background-size: 15px 100%;
Copy after login

height, controls the height of the dashed line, linear-gradient and background-size control the spacing and Step size

Generate vertical lines

Vertical lines are exactly the opposite of horizontal lines, just invert them.

width: 2px; background: linear-gradient(to bottom, #000000, #000000 7.5px, transparent 7.5px, transparent); background-size: 100% 15px;
Copy after login

Recommended tutorial:

css quick start

The above is the detailed content of How to use css to generate controllable dotted lines. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!