Home > Web Front-end > CSS Tutorial > How to draw horizontal lines in css

How to draw horizontal lines in css

WBOY
Release: 2021-12-02 15:34:16
Original
17800 people have browsed it

Method: 1. Add the "border-top: thickness value solid color;" style to the element and draw a horizontal line by setting the border attribute; 2. Add "height: thickness value; width: length;" to the empty element; "background-color: color;" style, draws horizontal lines by setting the background color of empty elements.

How to draw horizontal lines in css

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

How to draw horizontal lines in css

1. Use border borders to make horizontal lines

.h{
border-bottom: 1px solid black;
}
Copy after login

Add to elements border property, just set the border, you can create a horizontal line

How to draw horizontal lines in css

Output result:

How to draw horizontal lines in css

2. Use empty element settings

Set

height=1px to an empty element, and set the background background color. You can also set a horizontal line.

.space{
height: 1px;
background-color: black;
}
Copy after login

How to draw horizontal lines in css

Output result:

How to draw horizontal lines in css

(Learning video sharing: css video tutorial)

The above is the detailed content of How to draw horizontal lines in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template