I understood everything: https://jsfiddle.net/p357agt2/2/ .
There were a few things on which the rendering engine had a different opinion on how to portray things than you. I managed to make the given example of your layout:
First of all: note that the word STARS is wrapped in a <span> element.
<h3> <span>STARS</span><span>★★★★★</span> </h3>
Then: these are the minimum necessary rules for this.
span{ vertical-align:middle; } span:first-child{ font-size:40px; } span:last-child{ font-size:12px; }
So what I changed in your JSFiddle :
- I completely removed the
margin-bottom rule - I removed the
vertical-align rule from the stars class - I wrapped the word STARS in the
<span> element - I applied
vertical-align:middle to any span in h3 : h3 span - (Optional) I applied
margin-left:.3em; to .stars to create a small gap between STARS and β
β
β
β
β
ΒΉ
Basically, the text node STARS is needed to be inside the <span> for this. Then vertical-align must be applied to how .
Full code :
html, body { font-size: 100%; font-size: 12px; line-height: 1.2em; color: #333; } h3 { font-size: 2em; line-height:1em; font-weight: 100; } .stars { margin-left: .3em; opacity: 0.6; font-size: 0.7em; } h3 span{ vertical-align: middle; }
<h3> <span>STARS</span><span class="stars">★★★★★</span> </h3>
As far as I know, this fix changes your layout, code, and standard rendering (for example, those that display:table-cell work).
1: you can also get a space by dividing the line between two <span> nodes in the source code, but when you select this option it looks weird ...
Xufox source share