Home > Web Front-end > Front-end Q&A > How to draw lines in css

How to draw lines in css

藏色散人
Release: 2023-01-05 16:07:51
Original
10087 people have browsed it

How to draw a line in css: 1. Use the border attribute to achieve the effect of drawing a line, with code such as "border-bottom: 1px solid #000000;"; 2. Use the hr tag to achieve the effect of drawing a line.

How to draw lines in css

The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.

There are many ways to achieve the effect of drawing a heart in HTML. The simplest is to use the


tag or the border attribute in CSS.

1. Use border to achieve the effect of drawing a line

1. You can set a border-bottom attribute to an element of a certain width so that it has only one bottom border, thereby achieving the effect of drawing a line. The effect, the code is as follows:

<div id="div1">  
</div>
<style>
    #div1{
    margin-top: 100px;
    width: 900px;
    border-bottom: 1px solid #000000;
    }
</style>
Copy after login

2. The running effect is as follows:

How to draw lines in css

2. Use the hr tag to draw a line

1. Use the hr tag to achieve the effect of drawing a line. The code is as follows:

<html>
<body>
    <p>hr 标签定义水平线:</p>
    <hr />
    <p>这是段落。</p>
    <hr />
    <p>这是段落。</p>
    <hr />
    <p>这是段落。</p>
</body>
</html>
Copy after login

2. The running effect is as follows:

How to draw lines in css

Recommended learning: css video tutorial

The above is the detailed content of How to draw 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