I am looking to style an additional <hr>
tag for my side-bar on my website.
How might I be able to do this if I already have an hr defined?
hr { border: solid #ddd; border-width: 1px 0 0; clear: both; margin: 22px 0 21px; height: 0; }
Could I add a style?
hr.side { border: solid #ddd; border-width: 1px 0 0; clear: both; margin: 22px 0 21px; height: 0; }
so html would be
<hr class="side">
?
The HTML <hr> element is a block-level element and represents a horizontal rule. It creates a horizontal line. We can style the horizontal line by adding color to it.
You can simply use the CSS background-color property in combination with the height and border to the change the default color an <hr> element. In the following example we've changed the color of hr tag to light grey. You can also increase the thickness of the line by simply increasing the value of the height property.
The class attribute assigns one or more classnames to the <hr> tag. Classnames are defined in a stylesheet or in a local <style> element. Classes, i.e. classnames, are used to style elements.
use
hr.side { border: solid #ddd; border-width: 1px 0 0; clear: both; margin: 22px 0 21px; height: 0; }
then
<hr class="side">
in css the .
refers to a class , and #
to id
EDIT:
if you really really wanted to do inline styling with style=""
then it would look like this
<hr style="border: solid #ddd; border-width: 1px 0 0; clear: both; margin: 22px 0 21px; height: 0;">
This last method is not really the recommended way, but works great if you want to override all css style sheets, and also override any <style> </style>
tags that are embedded in HTML page
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With