How to apply css for a class within h2?

Tags: html,css

Problem :

I have an HTML code as follows

<h2><a class="toc-backref" href="#id8">Debug</a></h2>

How can I apply css format to Debug which is inside <a> (which is inside <h2>) with a class of "toc-backref"?

Solution :

You could put a span inside of the h2, but that's not necessary. If you want to style the <a> inside of the <h2>, just do something like:

h2 a {
  // style here

Or you can give the link a class:

h2 a.toc-backref {
  // style here

    CSS Howto..

    how to make edges of a line fade out?

    how to style a symfony2 form button

    How do I turn a string into a “selector”?

    How to check if a particular CSS value exists

    How can I position two divs on the same line and have them act responsive?

    How to select classes that are not nested? CSS

    How can I put a inside of an ? [duplicate]

    How do you create and run an html page directly from LocalStorage?

    How to remove unnecessary margin on top?

    How to set a single value of transform while leaving the other values?

    How To Refer To CSS Background Image in Visual Studio?

    How to add custom css in Cognos?

    How to make columns scroll independently using CSS?

    How could i make CSS apply to all in a div?

    How to apply padding to a column using and CSS in Firefox?

    Main navigation, classes on/off. HGelp understanding how this is built

    jQuery, how can i do to toggle a margin

    How can I transition height: 0; to height: auto; using CSS?

    How do you style Wordpress sub-menus with CSS?

    How to display text over an image css [duplicate]

    How to push a div from the top in percentage with css?

    CSS - how to align different font-sizes to each other?

    How does google elegantizr work?

    CSS: How to use Transform property on a bootstrap grid class

    How to create a full screen div on landing page

    How to understand other people's CSS architectures?

    How to show middle of image in div using css?

    How to make a ruler scale in HTML and CSS

    How to create a curve tail for speech bubble with CSS?

    How can I use CSS to make a multi-select box but have the label appear on top instead of to the left?