treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] Contact Form 7 classes

  • Does anyone know how to add classes to heading tags in contact form 7? I have tried using the standard and contact 7 convention for applying a class to a h2 tag but it always seems to target to the h2 in my css without a class.

    <h2 class="contact-heading">Get in Touch</h2>


    <h2 class:contact-heading>Get in Touch</h2>
  • Hmmm... are you calling the contact form in a page using the shortcode or in a template? Why not just keep the heading outside of CF7?
  • In a template using the embedded code you showed me but creating the classes within the contact 7 settings area in WP.

    Was thinking of setting the heading outside the form but thought there might be a way to do it within. What do you think?
  • What I have done, let's say, I want a two column for this plugging is:



    <div style="width:620px;">

    Half of the form here. You can add an image and a bunch of things like that in here.


    <div style="float:left; width:300px;">

    </div>

    <div style="float:left; width:300px;">

    The other Half of the form here.

    </div>

    </div>


    Obviously, I would put that CSS in the main style sheet.
  • I think I get what you mean. The bulk of the classes are set within the form yet you can set them outside too?
  • Actually not having much luck setting the styles outside the form, either. I set a h2 class="contact-heading" on the template above the embedded code for the CF7 and it keeps referring back to the h2 styles set for the main-content. Any ideas?
  • I do not know if you know this, but if you have a CSS that is telling all H2 that if you are in the Text area behave like this or like that, you can have a hack which will overwrite that, example:



    .myhack h2 {font-size:24px!important;}



    which means that if the H2 in other places are 14px, if you put the class some where in the doc, ex:



    <h2 class="myhack">My Subtitle</h2>



    Then subtitle will be 24px, and not 14px.
  • Just want to point out that ".myhack h2" will not target the HTML that you posted. You would need to use "h2.myhack" or just ".myhack".
  • Thanks Doc