Thomas
Thomas

Reputation: 543

Link with image inside

I am struggling with image inside a link. I don't know hot to make the first link (with image) be the same size as other links in paginations. I also don't know how to align them ?

.content .pagination a {
    text-decoration: none;
    color: #717171;
    border: 1px solid #c0c0c0;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    padding: 3px 8px;
    margin: 0 1px;
    background-color: #fff;
    background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed));
    background-image: -webkit-linear-gradient(top, #fff, #ededed);
    background-image: -moz-linear-gradient(top, #fff, #ededed);
    background-image: -ms-linear-gradient(top, #fff, #ededed);
    background-image: -o-linear-gradient(top, #fff, #ededed);
    background-image: linear-gradient(top, #fff, #ededed);
}

.content .pagination a.prev {
    padding: 11px;
    position: relative;
    vertical-align: middle;
    background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAICAYAAADaxo44AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAB4SURBVHjaYvj//z8DDBcWFqYBcTuIzQgiQKCoqCgNSM1kgAArsASyYEhICIMVEDB/+vTJDMjfiCSYBWSuZ7KxsdGFamd49OjRMiA1HcQGGWV5DAjWrFkDk0/v6+ubBbM8Eyg3DUnSnAHJuSDJ/1u2bAEy/5sBBBgAv6VOHKw5pxYAAAAASUVORK5CYII=) 8px 7px no-repeat;
    border: 1px solid #d9d9d9;
    line-height: 0;
    font-size: 0;
    color: transparent;
}

enter image description here

HTML code:

<div class="pagination">
                    <a href="#" class="prev">&lsaquo;</a>
                    <a href="#" class="active">1</a></div>

Upvotes: 0

Views: 99

Answers (2)

vals
vals

Reputation: 64164

May be the easier way to get that is to use an unicode character

CSS

 .pagination a {
    text-decoration: none;
    color: #717171;
    border: 1px solid #c0c0c0;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    width: 18px;
    padding: 3px 8px;
    margin: 0 1px;
    background-color: #fff;
    background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed));
    background-image: -webkit-linear-gradient(top, #fff, #ededed);
    background-image: -moz-linear-gradient(top, #fff, #ededed);
    background-image: -ms-linear-gradient(top, #fff, #ededed);
    background-image: -o-linear-gradient(top, #fff, #ededed);
    background-image: linear-gradient(top, #fff, #ededed);
}


 .pagination a.prev:before {
    content: "\03c";
}

fiddle

If you are interested in this technique, shapecatcher can be a valuable resource

Upvotes: 0

user2957312
user2957312

Reputation:

Are you talking about this ? :

                    <a href="#" class="prev"><img src="path"></a>
                    <a href="#" class="active"><img src="path"></a>



</div>

Upvotes: 1

Related Questions