Viewing 25 posts - 1 through 25 (of 25 total)
  • Author
    Posts
  • #917894

    Hi, Can someone tell me how to enter the colour for just 1 text input area, for instance, I want the first to be yellow like the UK registration Plate colour, and the rest to be normal.

    I was using this

    #top .main_color input[type=”text”], #top .main_color avia_1_1{
    border-color: gray;
    background-color: #ffcd26;
    color: blue;
    }

    But it makes all of them change colour and not just the one I want.

    Please advice.

    Many thanks.

    Text Input colour

    #918012

    Hey sambo258,

    Can we please see your web site?

    Best regards,
    Basilis

    #918342

    you can count the position of your input field and use the :nth-of-type
    something like:

    #top .main_color input:nth-of-type(1) {
    border-color: gray;
    background-color: #ffcd26;
    color: blue;
    }

    you can see how it will be used here: https://css-tricks.com/almanac/selectors/n/nth-of-type/

    The :nth-of-type selector is very similar to :nth-child but with one critical difference: it is more specific. In our example above they would produce the same result because we are iterating over only li elements, but if we were iterating over a more complex group of siblings, :nth-child would try to match all siblings, not only siblings of the same element type. This reveals the power of :nth-of-type—it targets a particular type of element in an arrangement with relation to similar siblings, not all siblings.

    #918363

    On the home page I want just the first box “Enter Reg” to be yellow.

    #918365

    don’t see your homepage

    #918382
    #918453
    #top.home .main_color input#avia_1_1[type="text"] {
        background-color: #ffcd26 !important;
        border-color: gray;
        color: blue
    }

    you can try it without important – seems to be selectiv enough

    #918793

    Hi,

    If the suggestions above don’t work then please try this:

    .home #av_section_1 #avia_1_1 {
      background-color: #ffcd26;
    }

    Best regards,
    Rikard

    #918862

    both will work – just add the color for the font to Rikards code

    #919381

    Hi,

    Thanks for the feedback @guenni007.

    Best regards,
    Rikard

    #922503

    Thank you so much, I don’t suppose anyone would know how to put a small image at the begging of the same box?

    For example Reg image

    #922628

    Hi,

    You would want to add the image to your media library, then add it as a background image to that specific input field. Perhaps you can target it with a class name.

    Best regards,
    Jordan Shannon

    #922849

    complete the code above with something like this:

    #top.home .main_color input#avia_1_1[type="text"] {
        background-color: #ffcd26 !important;
        border-color: gray;
        color: blue;
        background-image: url(https://www.wesellanyautopart.com/wp-content/uploads/2018/02/favi.png);
        background-size: contain;
        background-repeat: no-repeat;
        padding-left: 50px;
    }

    can you please change the code to https without s – boardsoflt changes to https automatically ????

    WHY?

    • This reply was modified 6 years, 8 months ago by Guenni007.
    #922856

    this will work too:

    #top.home .main_color input#avia_1_1[type="text"] {
        background-color: #ffcd26 !important;
        border-color: gray;
        color: blue;
        background-image: url(/wp-content/uploads/2018/02/favi.png);
        background-size: contain;
        background-repeat: no-repeat;
        padding-left: 50px;
    }

    don’t know why boardsoft did that auto correction

    #923213

    Hey Guenter,

    Thanks for the additional input on this.

    Best regards,
    Jordan Shannon

    #923440

    Thank you so much,

    Lastly how I put ENTER REG inside the box so people know what to type in it,

    Again thank you all so much for your help :)

    #923446

    Hi,

    Unfortunately, the default contact form does not allow for placeholder text.

    Best regards,
    Jordan Shannon

    #923763

    OK No worries, I thought there would of been a quick CSS for it. Never mind, thanks,

    #924420

    well on cf7 this is possible by setting up the form. and use this shortcode

    [text your-name placeholder "Your name here"]

    here you can try to influence via Child-theme functions.php:

    function change_placeholder_txt() {
    ?>
    <script type="text/javascript">
    	jQuery('#avia_1_1').attr('placeholder', 'Reg');
     </script>
    <?php
    }
    add_action('wp_footer', 'change_placeholder_txt');

    it works with the image too: but i would take the png without the yello background on the right in the image – just the GB only

    if you like to have a bit distance on placeholder text just add some spaces – and to be more specific your selector can be more precise

    function change_placeholder_txt() {
    ?>
    <script type="text/javascript">
    	jQuery('#top.home #avia_1_1').attr('placeholder', '  Enter Reg');
     </script>
    <?php
    }
    add_action('wp_footer', 'change_placeholder_txt');

    see results here (with name as placeholder and image): https://webers-testseite.de/kontakt/

    PS: on Safari it works too – but the autofill function does not find an input if placeholder text is different to the standard input name

    • This reply was modified 6 years, 8 months ago by Guenni007.
    #924428

    :lol btw : you have to change the reg plate after brexit ;)

    • This reply was modified 6 years, 8 months ago by Guenni007.
    #924862

    once again – i think it is better to alway have the scripts only on those pages where it is needed –
    so take this one only for your home page – so we can make the if clause with is_home()
    if it is a special page you can have is_page(123) etc
    allthough it is just a very tiny script – it does not have to be loaded on page where it is not needed

    function change_placehoder_txt() {
    if( is_home( ) ) {
    ?>
    <script type="text/javascript">
      jQuery('#avia_1_1').attr('placeholder', '  Enter Reg*');
     </script>
    <?php
    }
    }
    add_action('wp_footer', 'change_placehoder_txt');
    #929914

    Awesome, thanks a million Guenni007

    #929930

    Hey sambo258,

    Did you need further assistance on this topic or shall we close it?

    Best regards,
    Jordan Shannon

    #931470

    Close it, many thanks

    #931508

    Hi,

    Glad to hear that! Thanks for using Enfold :)

    Best regards,
    Nikko

Viewing 25 posts - 1 through 25 (of 25 total)
  • The topic ‘How to change the colour of just 1 text input area’ is closed to new replies.