Top Border Image in CSS3

Top Border Image in CSS3

I don't think that there is any such property like border-top-image to give image border to any side of an element -
Use

border-image:url('http://www.mycelticcrossstitch.com/celtic%20knot%20cross%20stitch.jpg') 30 30 round;

but it give border around all sides. To remove border around rest of the sides I gave -

border-bottom:0;
border-left:0;
border-right:0;

It worked and here is my fiddle - http://jsfiddle.net/ashwyn/c7WxG/1/

CSS border image only working on top and bottom

Without border-image

div {  width: 300px;  height: 300px;  background-color: #545050;  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAIAAAC0D9CtAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTCtCgrAAAABf0lEQVQ4T12SB3LDMAwE+USLYgFYZOv/n8iCkBUlMxgV4A71wjnbkCwp1j22mo8un6G9pFbS1Mr30SrfmvfB72xYOI/OazbpNQOdUs5hAYx0ny5wZqtvcuE5OmYcp+GdWkbNln6FKfIGjQ29CVjwBizloh1arWAtQwoVLL1FuwFGA4wF2SOgq7QFFK9mmweOp7OaXckiacdCer3ytl0Ib2A0q9C8gk9lBJa0wC/jYCUuWhfPeps33EuucQPt4IuD4WVvLOrJYXpykfGGYQ/OvrE06+fBsfG+Xd12cWqKEJjhX2/80hshaH96swqSrSuf2G4vLojLA00WjR3A4YvqbOYb1kMLSmEM9/sy4VONw4APlD4f+abkhrTEbkpulPG7zMkNTEq/2iEGiNX5oXzLpiZoj+OiiaVR6kppNSEIlxIrNo3xtMpl+Ys3iQViuNgbjSIZOOAYppU8xBRNcV2S6WISe3cNaieLiT1uLDA2lJYTasLqvks2NDfll6fpMKcfxz4t98bmcAYAAAAASUVORK5CYII='), url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAIAAAC0D9CtAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvq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HHbimupjC0LFuIpweL/Dq3egCbk7sa4bH2XcyTVWQtpk4O/y0mG8HubBIDtnCxZ8Rc39Tz1PJ0H5GjQYsimwcPoDJVa6P63J3PprIKtlZTMBKgxVjjaXzKKYBYDGm7F9Q2y2B9SqAAD/DeRE+L+DKsffps9B1TyPVfALb24FLMSEbyDYDqCzP0D2XlLfeYeYFOAAAAAElFTkSuQmCC'),url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAIAAAC0D9CtAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTCtCgrAAAABeklEQVQ4T12TDbLDIAiEPWLjP6hJev9LvA9N89LO0BlFll021EmOR5f33oij1RJ8fL1+ogY/pKya91CXvW8lnQvWZdRcwvYEpG27C86hvSYXt1eJvtfMnR5nE7JkFiD7TRHSqj0NHVpr9BMTvJa4z4cJq70k2MoE7FqoJkBCSLHjJylyoT3VC3aowRqAVhc/gCGZjJbkNEXmI7gPg8nF1uVqwRhddil0YVq6GIYeltWiKeySLz/u6GodAWBdt14OW2xKuponWYBpfWLoNcWbSQRyFibdGBsaSQ8Ms5HkiTM1nPEg9FpgRCE2oPhH25Jt7pHHbimupjC0LFuIpweL/Dq3egCbk7sa4bH2XcyTVWQtpk4O/y0mG8HubBIDtnCxZ8Rc39Tz1PJ0H5GjQYsimwcPoDJVa6P63J3PprIKtlZTMBKgxVjjaXzKKYBYDGm7F9Q2y2B9SqAAD/DeRE+L+DKsffps9B1TyPVfALb24FLMSEbyDYDqCzP0D2XlLfeYeYFOAAAAAElFTkSuQmCC');  background-position: top center, bottom center, center left, center right;  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;}
<div></div>

CSS help - make image in element exceed the top border

you didn't explain your html setup at all, so i can only suggest things very broadly, its difficult to know which would be more appropriate.

margin-top: -30px;

alternatively:

position: relative;  
top: -30px;

Different border images top and bottom

Put both “parts” into the same image, and use border-image-slice to determine what gets displayed where.

This property allows you to slice your image into nine “regions”, the outer eight of which are used for the borders and their “corners”, and the ninth to fill the background of the element (the latter only if keyword fill is set).

border-image over an image

You can achieve that by:

Using the image as a background

.sprocket-mosaic-image-container {    position: absolute;         /** define width and height of the image **/    width: 375px;    height: 281px;        /** set the box sizing so the border dimensions would be part of the width and height **/    box-sizing: border-box;         border-style:solid;    border-width: 60px 28px 87px 24px;    -moz-border-image: url(http://i.imgur.com/qfJxhX2.png) 60 28 87 24 repeat;    -webkit-border-image: url(http://i.imgur.com/qfJxhX2.png) 60 28 87 24 repeat;    -o-border-image: url(http://i.imgur.com/qfJxhX2.png) 60 28 87 24 repeat;    border-image: url(http://i.imgur.com/qfJxhX2.png) 60 28 87 24 repeat;        /** set the image as background **/    background: url(http://i.imgur.com/rdZ1sYQ.jpg) no-repeat;        /** define the origin so the image would be under the border **/    background-origin: border-box;        z-index:1;}
.sprocket-mosaic .sprocket-mosaic-image { position:relative; z-index:0;}
<div class="sprocket-mosaic-image-container"></div>

Top border with gradient using css

you could use an image http://border-image.com/ or use a pseudo element over your border :

.bordertest {
height:300px;
width:300px;
border-top:30px solid #c4268c;
background:#000;
position:relative;
margin:1em;
}
.bordertest:first-child:before {
content:'';
position:absolute;
width:100%;
height:30px;
background:linear-gradient(to left, #c4268c, #9a0b72);
top:-30px;
left:0;
}

http://jsfiddle.net/aKhjk/1/ - jsfiddle.net/aKhjk/3

CSS: how do i make border-top of a link into an image when my mouse hovers over the link

You can use a background-image on hover which will have both the borders you want to show.

a {
border-top:5px;
border-bottom:5px;
height:50px;
}
a:hover {
border:none;
background-image:url(image.jpg);
height:60px;/*normal height + missing borders*/
}

All you need to do is create an image with the top border on top, the bottom border on bottom which has the height of the element + the height of both borders added.

Also, once you remove the borders on hover, you need to adjust the height of the element, so it doesnt change its height because of the missing borders.

True height = height prop + borders + padding.

I wouldnt use border image for this as it is not yet widely supported.

CSS Border on top of background image (same div?)

Is this what your trying to achieve? jsFiddle

#content {
position: relative;
margin: 0 auto;
top: 50px;
width:800px;
overflow:hidden;
background:#ccc;
width:800px;
}
.greycontent {
position: relative;
z-index: 1;
height: 350px;
width:350px;
border:1px solid #fff;
background:#ccc;
margin:0 auto 60px;
}

Updated your jsFiddle.



Related Topics



Leave a reply



Submit