-
AuthorPosts
-
February 26, 2018 at 5:32 pm #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.
February 26, 2018 at 9:09 pm #918012Hey sambo258,
Can we please see your web site?
Best regards,
BasilisFebruary 27, 2018 at 10:41 am #918342you 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.
February 27, 2018 at 11:18 am #918363On the home page I want just the first box “Enter Reg” to be yellow.
February 27, 2018 at 11:26 am #918365don’t see your homepage
February 27, 2018 at 12:12 pm #918382February 27, 2018 at 2:04 pm #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
February 28, 2018 at 5:13 am #918793Hi,
If the suggestions above don’t work then please try this:
.home #av_section_1 #avia_1_1 { background-color: #ffcd26; }
Best regards,
RikardFebruary 28, 2018 at 9:05 am #918862both will work – just add the color for the font to Rikards code
March 1, 2018 at 6:04 am #919381March 6, 2018 at 9:06 pm #922503Thank 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
March 7, 2018 at 12:47 am #922628Hi,
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 ShannonMarch 7, 2018 at 11:16 am #922849complete 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, 9 months ago by Guenni007.
March 7, 2018 at 11:26 am #922856this 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
March 7, 2018 at 6:59 pm #923213Hey Guenter,
Thanks for the additional input on this.
Best regards,
Jordan ShannonMarch 7, 2018 at 11:21 pm #923440Thank 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 :)
March 7, 2018 at 11:26 pm #923446Hi,
Unfortunately, the default contact form does not allow for placeholder text.
Best regards,
Jordan ShannonMarch 8, 2018 at 11:29 am #923763OK No worries, I thought there would of been a quick CSS for it. Never mind, thanks,
March 9, 2018 at 11:38 am #924420well 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, 9 months ago by Guenni007.
March 9, 2018 at 11:55 am #924428:lol btw : you have to change the reg plate after brexit ;)
- This reply was modified 6 years, 9 months ago by Guenni007.
March 10, 2018 at 7:57 am #924862once 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 neededfunction 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');
March 20, 2018 at 4:18 pm #929914Awesome, thanks a million Guenni007
March 20, 2018 at 4:37 pm #929930Hey sambo258,
Did you need further assistance on this topic or shall we close it?
Best regards,
Jordan ShannonMarch 22, 2018 at 5:19 pm #931470Close it, many thanks
March 22, 2018 at 6:08 pm #931508Hi,
Glad to hear that! Thanks for using Enfold :)
Best regards,
Nikko -
AuthorPosts
- The topic ‘How to change the colour of just 1 text input area’ is closed to new replies.