In my React app, I am using emotion
to style and display the formula for compound interest. Within my render()
method, I am returning the following:
<div css ={equation}>
<p>
P (1 +</p>
<p css={fraction}>
<span className="num">1</span>
<span className="symbol">/</span>
<span className="bottom">2</span>
</p>
)
<sup>(nt)</sup>
</div>
Additionally, outside of the component I have defined the following:
const fraction = css`
display: inline-block;
position: relative;
vertical-align: middle;
letter-spacing: 0.0001em;
text-align: center;
.num {
display: block;
padding: 0;
height: 12px;
line-height: 12px;
}
.bottom {
border-top: thin solid black;
}
.symbol {
display: none;
}
`
const equation = css`
font-size: 100%;
.p{
font-size:large !important;
}
`;
While the fraction styling is working as expected, I am encountering issues with changing the font size of the p
elements. I have tried various methods, including using the font-size
property within the emotion css styling, but so far have been unsuccessful. I managed to change the font size by switching p
to h1
elements, but I would prefer to find a solution that allows me to specify the font size within the emotion styling for p
elements.