Reputation: 3491
I am having a problem to align text in the same div when the text is in Chinese.
It pushes the right span to the top from some reason.
Is there a way to fix this issue?
.left{
float:left
}
.right{
float:right;
}
div{
clear:both;
width:400px;
}
<div>
<span class="left">【夏向け】怖い、こっくりさん【ホラー】</span>
<span class="right">Android</span>
</div>
<div>
<span class="left">Hello world</span>
<span class="right">Facbook</span>
</div>
<div>
<span class="left">【夏向け</span>
<span class="right">Android</span>
</div>
<div>
<span class="left">This is an example text</span>
<span class="right">Android</span>
</div>
Upvotes: 1
Views: 308
Reputation: 1312
You have to use the line-height
and font-size
property accordingly
.left{
float:left
}
.right{
float:right;
}
div{
clear:both;
width:400px;
line-height: 24px;
}
<div>
<span class="left">【夏向け】怖い、こっくりさん【ホラー】</span>
<span class="right">Android</span>
</div>
<div>
<span class="left">Hello world</span>
<span class="right">Facbook</span>
</div>
<div>
<span class="left">【夏向け</span>
<span class="right">Android</span>
</div>
<div>
<span class="left">This is an example text</span>
<span class="right">Android</span>
</div>
Upvotes: 2
Reputation: 1733
float
is messing up the code
.left{
display:table-cell;
text-align:left;
}
.right{
display:table-cell;
text-align:right;
}
div{
display: table;
width:500px;
}
<div>
<span class="left">【夏向け】怖い、こっくりさん【ホラー】</span>
<span class="right">Android</span>
</div>
<div>
<span class="left">Hello world</span>
<span class="right">Facbook</span>
</div>
<div>
<span class="left">【夏向け</span>
<span class="right">Android</span>
</div>
<div>
<span class="left">This is an example text</span>
<span class="right">Android</span>
</div>
Upvotes: 0