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

How to draw horizontal lines in css

WBOY
WBOYOriginal
2021-12-02 15:34:1617557browse

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;
}

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;
}

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!

Statement:
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