I have a headlineh2
html element followed by a span
tag. Both should be shown in a single line.
My purpose is to show text, followed by rating stars. I'm using html+css from Turn a number into star rating display using jQuery and CSS as follows:
<h2 style="display:inline">title
<span class="stars" style="width:150px">
<span style="width:100px;"/>
</span>
</h2>
span.stars, span.stars span {
display: block;
background: url(stars.png) 0 -16px repeat-x;
height: 16px;
}
span.stars span {
background-position: 0 0;
}
This works fine, BUT it introduces a linebreak. How can I prevent it?
When I change the following, it would work:
span.stars, span.stars span {
display: inline-block;
}
But is this the right way to achieve this? Doesn't inline-block
cause problems in some browsers?