-1

I'm making a stylesheet for a subreddit and I'm having an issue styling text.

The markup in this problem is as follows:

<span class="value">
    <span class="number">1</span>em;
</span>

I want to style that em; though I can't use span.number + * for some reason. Is there anyway I can select it without using .value?

Spedwards
  • 4,167
  • 16
  • 49
  • 106
  • 2
    You can't use the + selector because the em isn't in another element. It is simply text, which cannot be selected in it of itself in CSS. You would need to either encapsulate it in its own element or style it using a parent element. – Liftoff Mar 30 '15 at 04:20
  • So there's nothing I can do. That's all I needed to know. – Spedwards Mar 30 '15 at 04:23

3 Answers3

1

It's not a child of the number class. It's a sibling since it's sitting outside of the inner span.

.value is the closest you can get to that particular text.

xengravity
  • 3,501
  • 18
  • 27
0

Try this way. use pseudo class :after or use another element contain the em.

.number:after{
  content: 'em';
  color: #c33;
  }
<span class="value">
    <span class="number">1</span>
</span>
Todd Mark
  • 1,847
  • 13
  • 25
-1

You may have to use another span class surrounding the em; if you are unable to modify it using .value

Kinburn101
  • 1,112
  • 2
  • 9
  • 18