Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS fake HR with background image

Tags:

css

I want to have a HR like background image. a 2 pixel wide gif file.
I looked into styling the HR tag, but too much browser issues..

Used a 2px high div with the image as bg, but in IE6, there is a padding I can not seem to get rid of.
Any suggestions welcome!

CSS:

.hr {
    margin: 0; padding: 0;
    height: 2px;
    background-image: url('images/help-hr.gif');
    background-repeat: repeat-x;
    background-color: green; /* just to see the padding in IE6 */
}

HTML:

<p>sky</p>
<div class="hr"></div>
<p>grass</p>
like image 713
FFish Avatar asked Jan 27 '26 20:01

FFish


1 Answers

Add overflow:hidden;

.hr {
    margin: 0; padding: 0;    
    height: 2px;    
    background-image: url('images/help-hr.gif');
    background-repeat: repeat-x;
    background-color: green; /* just to see the padding in IE6 */

    overflow:hidden;
}
like image 184
Moksha Avatar answered Jan 30 '26 08:01

Moksha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!