I have the following code on my page:
.fraction {
vertical-align: middle;
display: inline-block;
}
.frtop, .frbottom {
text-align: center;
}
.frbottom {
border-top: 1px solid;
}
<p style="text-indent: 2em;">
The fraction
<div class="fraction">
<div class="frtop">1</div>
<div class="frbottom">20000</div>
</div>
equals to 0.00005.
</p>
where I am trying to display an inline fraction in an indented paragraph.
However, the fraction is displayed on a separate line: There is a line break between the text The fraction
and the fraction itself. How can I fix this?
Note 1: This problem does not occur if I use div
instead of p
to define my whole paragraph; however, in this case I have to add text-indent: 0;
in the CSS code of the .fraction
definition and the content does not seem semantically correct to me: I do want to use p
to define all my paragraphs.
Note 2: Obviously, I have to replace div
with span
. However, I need some extra things in the CSS code I provided, so that it works.
...
` tags. It is about ***the necessary CSS code***, so that a fraction can be displayed _inline_ using the tags `...`. – FedKad Mar 31 '21 at 07:34