Text nodes cannot have margins or any other style applied to them, so anything you need style applied to must be in an element. If you want some of the text inside of your element to be styled differently, wrap it in a span
or div
, for example.
More Related Contents:
- What does the “>” (greater-than sign) CSS selector mean?
- Is there a CSS selector for elements containing certain text?
- What does the “~” (tilde/squiggle/twiddle) CSS selector mean?
- nth-of-type vs nth-child
- How to select a range of elements in repeated pattern
- How do I select the “last child” with a specific class name in CSS? [duplicate]
- css3 nth of type restricted to class [duplicate]
- wildcard * in CSS for classes
- CSS Child vs Descendant selectors
- Matching an empty input box using CSS
- What is the difference between a pseudo-class and a pseudo-element in CSS?
- not:first-child selector
- SASS: randomly pick background-image from a list
- What does “i” mean in a CSS attribute selector?
- Is there a workaround to make CSS classes with names that start with numbers valid? [duplicate]
- What does + mean in CSS? [duplicate]
- CSS Selector for nth range?
- CSS selector (id contains part of text)
- How do I get the nth child of an element using CSS2 selectors?
- What’s the difference between CSS3’s :root pseudo class and html?
- Is the :before pseudo-element allowed on an input[type=checkbox]?
- CSS 3 nth of type restricted to class [duplicate]
- CSS select multiple descendants of another element
- Select all ‘tr’ except the first one
- What are the rules around whitespace in attribute selectors?
- CSS – First child without certain class
- CSS select first element with a certain class
- Correct terms and words for sections and parts of selectors
- What is the difference between pseudo-classes and pseudo-elements?
- Shorten verbose CSS that repeats combinations of elements and pseudo-classes