Unstyling <hr> when it's wrapped in a div
I have a div that wraps around my <footer>
tag. In the div is an <hr>
, which needs to be in the div to have the positioning properties applied. However, it also carries over the coloring of the links in my footer. I don't want the <hr>
to be the same color as the links. Is there any way to "escape" this or change the property.
I tried <hr style="color: black;">
but that didn't change anything. If you have any input on how to change the properties despite the set CSS in the div, I would greatly appreciate it.
JS Fiddle: http://jsfiddle.net/o6vmz7t5/1/
HTML
<div id="footer_style">
<hr>
<footer>
<a href="">Contact</a>
<a href="">Privacy Policy</a>
<a href="">Create Account</a>
</footer>
</div>
CSS
#footer_style {
margin: 0 auto;
position: fixed;
bottom:0;
width: 100%;
padding: 20px;
}
#footer_style a {
color: #f2f0e1;
}
#footer_style a:hover {
color: black;
}
hr tags simply have a border-top applied on them
override the hr as below
#footer_style hr {
border-top: 1px solid black;
}
#footer_style hr {
background-color: black;
height:1px;
}
的jsfiddle
Whoa, it had me struggling for a minute. Apparently since the hr has no height and you cant see its internal "fill", affecting the color does nothing.
What you actually see is the border, so using border-color
did it for me.
上一篇: CSS背景图像适合宽度,高度应该是自动的