Reputation: 59
I am working on aligning two span
elements should be present in same line but have separated as shown in below. The code i am using is below.
If I do not use float:right
the both texts are coming in single line with attaching one each other.
If I use float:right;
they are not aligning in same line, having some misalignment between them.
with float:right;
the result will be this
without float:right;
the result will be this
Please give me suggestions for this
.clearSpan {
color: $alt-dark-blue;
float: right;
cursor: pointer;
clear: both;
font-size: 10px;
}
.saveSpan {
color: $alt-dark-blue;
clear : both;
cursor: pointer;
font-size: 10px;
}
<div>
<span class="saveSpan" >Save as Default Filters</span>
<span class="clearSpan" >Clear All Filters</span>
</div>
Upvotes: 2
Views: 5337
Reputation: 15639
You need to define a style for your span tags as,
span {
display: inline-block;
}
Upvotes: 0
Reputation: 367
Maybe you can do:
.clearSpan {
margin-left: 15px;
}
or
.saveSpan {
margin-right: 15px;
}
That should separate it.
Upvotes: 0
Reputation: 60543
you can use flexbox
for that
div {
display: flex;
justify-content: space-between;
border-bottom: 1px solid grey
}
span {
color: blue;
cursor: pointer;
font-size: 10px;
}
<div>
<span class="saveSpan">Save as Default Filters</span>
<span class="clearSpan">Clear All Filters</span>
</div>
Upvotes: 2