Here are 3 examples that will add spaces in this scenario:
-
Using
codes between links
link # 1 ( a href …)
link # 2 (a href …)
2. Using an empty <span class="spacing"></span>
‘spacing’ can be defined in css as:
.spacing {
padding-right: 20px;
}
3. Adjusting the padding-right
property of <a>
tag
.pagination a {
padding-right: 20px;
// other attributes
}
Setting padding:left
or padding:right
on the li should work
.pagination li{
display:inline-block;
list-style-type:none;
padding-left: 10px;
padding-right: 10px;
}
Need to set padding:0 on UL tag and anchor tag define display:inline-block and set padding as you want so check below snippet.
.pagination{
background:#155484;
padding: 0;
margin: 0;
border: 2px solid #155484;
border-radius:3px;
position: relative;
display: inline-block;
}
.pagination li{
display: inline-block;
list-style-type: none;
}
.pagination a{
color: #fff;
border-radius:3px;
display: inline-block;
padding: 8px 12px;
text-decoration:none;
background: #155484;
}
.pagination a:hover, .pagination a.current{
background: #fff;
color: #155484;
}
<ul class="pagination">
<li><a href="#">Prev</a></li>
<li><a href="#" class="current">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">5</a></li>
<li><a href="#">Next</a></li>
</ul>
CSS:
.pagination{
position:absolute;
right:18%;
top:75%;
}
.pagination li{
display:inline-block;
list-style-type:none;
text-align:center;
}
.pagination a{
color:#fff;
text-decoration:none;
font-size:25px;
}
.back{
background:#155484;
padding:20px;
border:2px solid #fff;
border-radius:3px;
float:left;
}
.next{
margin-left:10px;
background:#155484;
padding:20px;
border:2px solid #fff;
border-radius:3px;
float:right;
}
HTML:
<div class="pagination">
{block:Pagination}
{block:PreviousPage}
<div class="back">
<a href="{PreviousPage}">《</a>
</div>
{/block:PreviousPage}
{block:NextPage}
<div class="next">
<a href="{NextPage}">》</a>
</div>
{/block:NextPage}
{/block:Pagination}
</div>
I am very new to this, so sorry for any misuse of vocab.
I want to have a space between two buttons, which have an inline-block display. The “margin” property doesn’t do what I need it to do.
CSS:
.pagination{
background:#155484;
padding:20px;
border:2px solid #155484;
border-radius:3px;
position:absolute;
left:75%;
top:75%;
}
.pagination li{
display:inline-block;
list-style-type:none;
}
.pagination a{
color:#fff;
text-decoration:none;
}
HTML
<div class="pagination">
{block:Pagination}
{block:PreviousPage}
<a href="{PreviousPage}">←</a>
{/block:PreviousPage}
{block:NextPage}
<a href="{NextPage}">→</a>
{/block:NextPage}
{/block:Pagination}
</div>
(This is using Tumblr-specific variables.)
Also if there’s anything in here that can be changed or omitted, that would be great to know!
re:jgetner Thank you, but this didn’t change anything at all. 🙁
can we see a code snippet or codepen of the issue?. did you try using padding?
No.3 is the right way to go, I would actually not recommend the other two methods.