• Resolved harveyl12

    (@harveyl12)


    I need some help with some CSS on my site…

    If you go to https://hcldesign.co.uk/ and then scroll down to the contact form you can see that when you click into a field, type into a field, or have an error in a field it changes the color of that filed and the borders.

    1. I can’t figure out what CSS i need to add to change the color of the fields when they are selected, have characters entered in them or have an error? including the border color.

    2. I also can’t figure out how to change the hover color for the text and button on the ‘send’ button.

    Any help?

    Thanks,

    Harvey

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 29 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I can’t figure out what CSS i need to add to change the color of the fields when they are selected, have characters entered in them

    You’re looking for the ‘focus’ selector.
    For instance to change the background to red & the border to blue, try:

    
    div.wpforms-container-full .wpforms-form input:focus {
        background: red;
        border-color: blue;
    }
    

    And try this to change the styles on error:

    
    div.wpforms-container-full .wpforms-form .wpforms-field input:focus.wpforms-error {
        background: pink;
        border-color: yellow;
    }
    
    • This reply was modified 7 years, 6 months ago by Andrew Nevins.
    Thread Starter harveyl12

    (@harveyl12)

    The top code works perfectly thanks but the bottom one does not change the color of the red background. If you visit my site you will be able to see the outcome with the two codes added above. I have changed the top one to different colors though.

    Also any ideas about the hover color for the test and background of the button?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Have you cleared your browser’s cache? On-error the field turns pink & has a yellow border for me.

    Also any ideas about the hover color for the test and background of the button?

    Which button?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Try this:

    
     div.wpforms-container-full .wpforms-form button[type=submit]:hover {
         background: pink;
         border-color: yellow;
     }
    
    Thread Starter harveyl12

    (@harveyl12)

    Hi,

    Right i now have it set to a black background. For some reason when i type the first character in the e-mail field it goes red and blue then if i click out of the field and then back into the field this is when it goes black?

    Any ideas?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    To confuse us, your theme is also adding a class called ‘is-focused’ through JavaScript when you click onto the field, with the following CSS applied to the input field:

    
    .form-group.has-error.is-focused .form-control {
        background-image: -webkit-gradient(linear, left top, left bottom, from(#f44336), to(#f44336)), -webkit-gradient(linear, left top, left bottom, from(#d2d2d2), to(#d2d2d2));
        background-image: -webkit-linear-gradient(#f44336, #f44336), -webkit-linear-gradient(#d2d2d2, #d2d2d2);
        background-image: linear-gradient(#f44336, #f44336), linear-gradient(#d2d2d2, #d2d2d2);
    }
    

    So it looks like you need to change the background there, e.g.:

    
    .form-group.has-error.is-focused .form-control {
        background: blue;
    }
    
    Thread Starter harveyl12

    (@harveyl12)

    I think that has done the trick!

    That must have been why i was getting to confused about this one as i was trying to change this with the above selectors yesterday… just not the over parts you mentioned earlier today.

    Also… was there any CSS that changes the color of a filed entered correctly?

    Thanks so much for the help!!!

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Also… was there any CSS that changes the color of a filed entered correctly?

    Try:

    
    body div.wpforms-container-full .wpforms-form .wpforms-valid {
        background: green;
    }
    
    Thread Starter harveyl12

    (@harveyl12)

    perfect!

    I found this one awkward as when inspecting it was tricky to get the code to stay appeared while clicking around the page etc. You got any tips for this to make it easier in the future?

    Thanks,

    Harvey

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Yeah, which browser are you using?

    Thread Starter harveyl12

    (@harveyl12)

    Chrome is the main one i use when developing

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Same. Chrome has a setting inside the developer toolbar, still under the ‘Elements’ tab.

    Inspect the input element and on the right-hand pane, press the “:hov” button. This will expand more options for; ‘active’, ‘focus’, ‘hover’ and ‘visited’. Selecting one of these checkboxes will emulate the state, for instance selecting the ‘focus’ checkbox will show the input field in its focus (clicked on) state.
    https://i.stack.imgur.com/NwulC.png

    After you select a checkbox, go back to the HTML panel and select on another element, then re-select the input element. This allows the CSS to update properly in the developer toolbar.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Just be aware that you cannot replicate JavaScript events through this “:hov” button.

    Thread Starter harveyl12

    (@harveyl12)

    Okay thanks for all the info, this will definelty help in the future.

    Lastly any idea about the hover colour r te send button on the contact form?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

Viewing 15 replies - 1 through 15 (of 29 total)
  • The topic ‘WPForm CSS Help’ is closed to new replies.