I need to draw a horizontal line after some block, and I have three ways to do it:
1) Define a class h_line
and add css features to it, like
<
it is depends on requirement , but many developers suggestions is to make your code as simple as possible . so, go with simple "hr" tag and CSS code for that.
In HTML5, the
<hr>
tag defines a thematic break. In HTML 4.01, the<hr>
tag represents a horizontal rule.
http://www.w3schools.com/tags/tag_hr.asp
So after definition, I would prefer <hr>
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #ccc;
margin: 1em 0;
padding: 0;
}
<div>Hello</div>
<hr/>
<div>World</div>
Here is how html5boilerplate does it:
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #ccc;
margin: 1em 0;
padding: 0;
}
I'd go for semantic markup, use an <hr/>
.
Unless it's just a border what you want, then you can use a combination of padding, border and margin, to get the desired bound.