html – ‘s之间的水平规则

现在,我有3个div,Content1,Content2,Content3

我想添加一个简单的程式化规则来分隔每个内容.这是我正在使用的代码.

HTML

<div id="Content1">
     <p><strong>Content1</strong></p>
     </div>

     <div id="Content2">
     <p><strong>Content2</strong></p>
     </div>

     <div id="Content3">
     <p><strong>Content3</strong></p>
     </div>

我想在Content1和Content2之间以及Content2和Content3之间添加一个水平规则.

我已经包含了一张图片,因此您可以清楚地看到我的意思.

谢谢!

解决方法

不要使用< hr>为此,因为它主要是一个语义元素而不是表示元素.底部边框是理想的选择.例如. http://codepen.io/pageaffairs/pen/pjbkA
<!DOCTYPE html>
<html lang="en">
<head>
<Meta charset="utf-8">

<style media="all">

div {width: 500px; padding-bottom: 10px; }
#Content1,#Content2 {border-bottom: 3px solid #4588ba; margin-bottom:10px;}
div p {background: #4588ba; line-height: 150px; font-size: 2em; font-family: sans-serif; color: white; margin: 0; padding-left: 30px;}

</style>

</head>
<body>

     <div id="Content1">
     <p><strong>Content1</strong></p>
     </div>

     <div id="Content2">
     <p><strong>Content2</strong></p>
     </div>

     <div id="Content3">
     <p><strong>Content3</strong></p>
     </div>

</body>
</html>

相关文章

vue阻止冒泡事件 阻止点击事件的执行 &lt;div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些