html – ‘s之间的水平规则
发布时间:2020-12-14 23:33:50 所属栏目:资源 来源:网络整理
导读:现在,我有3个div,Content1,Content2,Content3 我想添加一个简单的程式化规则来分隔每个内容.这是我正在使用的代码. HTML div id="Content1" pstrongContent1/strong/p /div div id="Content2" pstrongContent2/strong/p /div div id="Content3" pstrongConte
现在,我有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> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |