我正在尝试将div标签内的文本与链接对齐但我无法做到。请看一下小提琴。图像略高于文本第6页。
<display:setProperty name="paging.banner.full" value='<span class="pagelinks"> <a href="{1}"> <img src="../images/integration/FastLeft.jpg"/> </a> <a href="{2}"> <img src="../images/integration/SlowLeft.jpg"/> </a> | Page {5} of {6} | <a href="{3}"> <img src="../images/integration/SlowRight.jpg"/> </a> <a href="{4}"> <img src="../images/integration/FastRight.jpg"/> </a></span>'/>
<display:setProperty name="paging.banner.first" value='<span class="pagelinks"> <img src="../images/integration/FastLeft.jpg"/> <img src="../images/integration/SlowLeft.jpg"/>  | Page {5} of {6} |  <a href="{3}"> <img src="../images/integration/SlowRight.jpg"/> </a> <a href="{4}"> <img src="../images/integration/FastRight.jpg"/> </a></span>'/>
<display:setProperty name="paging.banner.last" value='<span class="pagelinks"> <a href="{1}"> <img src="../images/integration/FastLeft.jpg"/> </a> <a href="{2}"> <img src="../images/integration/SlowLeft.jpg"/> </a> | Page {5} of {6} | <img src="../images/integration/SlowRight.jpg"/> <img src="../images/integration/FastRight.jpg"/> </span>'/>
CSS
.pagelinks {
float: right;
margin-right: 48%;
display: inline-block;
background-size: cover;
background-repeat: no-repeat;
color: #828282;
}
.pagelinks a {
text-decoration: none;
display: inline-block;
background-repeat: no-repeat;
}
由于
答案 0 :(得分:1)
使用flexbox:
.pagelinks {
display: flex;
/* vertical centering on flex row content */
align-items: center;
/* horizontal centering on flex row content*/
justify-content: center;
}