I have an image that I'd like to set as the border on an element, but only as the bottom border: <- It's teeny - but it's right there.
Here is what I've got so far:
<style>
body { margin: 0; padding: 10px; }
h1 {
background-color: red;
border: solid transparent;
border-width: 2px;
border-image: 2 repeat url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAADCAYAAACqPZ51AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAB9JREFUeNpiZGBgOMOABv7//48uxMDEQCQgWiFAgAEAjqADz4EvP7IAAAAASUVORK5CYII=");
}
</style>
<h1>Bacon</h1>
<p>Bacon ipsum dolor sit amet tenderloin drumstick ribeye filet mignon t-bone beef ribs. Tri-tip venison turkey salami drumstick chicken pastrami. Frankfurter pork jowl ball tip tail.</p>
Or see JS Fiddle: http://jsfiddle.net/eqpt5/.
As you can see, this puts the border image on both the top and bottom (and the sides - though you can't see it). How can I put a border image on only the bottom using border-image
?
If you want to set a border to just one side of the element, use four values (write none to the side you want no border to appear). If you want to set a border to the top and bottom sides, use two values (write none to the second value).
The border-image-slice property specifies how to slice the image specified by border-image-source. The image is always sliced into nine sections: four corners, four edges and the middle. The "middle" part is treated as fully transparent, unless the fill keyword is set.
The <img> border attribute is used to specify the border width around the image. The default value of <img> border attribute is 0. It is not supported by HTML 5. Use CSS instead of this attribute.
Change border-width:2px
to border-width:0 0 2px
In this way you are actually setting border bottom width 2px and other sides width equal to zero
Demo http://jsfiddle.net/naveenksh/eqpt5/3/
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