Home  >  Article  >  Web Front-end  >  How to set dividing line in css

How to set dividing line in css

藏色散人
藏色散人Original
2021-05-13 14:23:2714984browse

How to set the dividing line in css: first create an HTML instance file; then create three divs in the body; finally set the style of the second div to "padding-top:3px;width:40%; border-top:1px solid #666666;" is all.

How to set dividing line in css

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

Use native HTML CSS to create a dividing line

The code is as follows:

<html>
<title>分割线</title>
<body>
<div>
<span>设备:</span>
<span>1</span>
</div>
<div class="order">
  <span style="white-space:pre">   </span><span class="line"></span>
  <span style="white-space:pre">   </span><span class="txt">这里是一个分割线</span>
  <span style="white-space:pre">   </span><span class="line"></span>
</div>
<div>
<span>设备:</span>
<span>2</span>
</div>
<style type="text/css">
.order {
  height: 20px;
  line-height: 20px;
  text-align: center;
}
.order .line {
  display: inline-block;
  padding-top : 3px;
  width: 40%;
  border-top: 1px solid #666666;
}
.order .txt {
  color: #333333;
  font-size: 12px;
  vertical-align: middle;
}
</style>
</body>
</html>

The effect is as shown below:

How to set dividing line in css

Learning video sharing: css video tutorial

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