与里面的图像链接

时间:2013-11-09 17:13:17

标签: html css html5 css3

我正在努力处理链接中的图像。我不知道如何使第一个链接(带图像)与分页中的其他链接大小相同。我也不知道如何对齐它们?

.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>

2 个答案:

答案 0 :(得分:1)

你在谈论这件事吗? :

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



</div>

答案 1 :(得分:0)

可能更简单的方法是使用unicode字符

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

如果您对此技术感兴趣,shapecatcher可能是宝贵的资源