StackOverflow StackOverflow - 1 month ago 8
C# Question

Add CSS to static text & not dynamic in one element

I would like to add styles to only the static text

"Hello Foo"

How Hello is created


Foo comes to the view through the users input using Jquery by getting the element by ID & placeing that next to Hello.

I want to have "Hello" bold, but am not sure how to do so. When I add a CSS to the ID or the class it makes the whole line bold, not just the word "Hello"

Let me know if you have questions.


Try wrapping Hello in a span and using css like

#NameID span {
  font-weight: bold;

As long as the Foo is outside of the span, only the "Hello" will be in bold.