Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #341031

    Hi,

    is there a way to style the standard search box in Enfold? Here’s what I would like to do:

    1) Increase the height of the search box
    2) Make the placeholder text more visible (i.e. darker color, bigger font size)
    3) Let the placeholder text disappear on focus (i.e. when I place the mouse cursor in the search box)

    Also, a minor issue – the search box on our homepage (infotropic.ru) is not vertically centered within the video background section. I did add the search box via a widget module. Didn’t have that issue with a text module.

    Best regards,
    Holger

    #341282

    Hey Holger!

    Thank you for using Enfold.

    Please use this on Quick CSS or custom.css to adjust the search box:

    #top #s {
    height: 50px;
    }
    
    #top #searchsubmit, .ajax_load {
    width: 40px;
    height: 50px;
    line-height: 40px;
    }
    
    input#s[placeholder] {
    font-size: 18px;
    }

    Use this on functions.php to remove the placeholder on focus:

    function remove_placeholder(){
    ?>
    <script>
    jQuery(window).load(function(){	
    	jQuery('input,textarea').focus(function(){
    		$(this).removeAttr('placeholder');
    	});
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'remove_placeholder', 10);

    Regards,
    Ismael

    #342114

    Hi Ismael,

    thanks a lot. The styling issue is resolved. But the placeholder is still visible on focus. I do add the code at the end of the functions.php file, correct? And is there chance to get the search field centered vertically in the colored section (see infotropic.ru)? It is placed there via a widget. Didn’t have that problem with a text field.

    Best regards,
    Holger

    #343150

    Hi!

    to center the search field use this in your Quick CSS:

    .widget {
    padding: 0;
    }
    

    The php code for functions.php which Ismael provided works fine for me. Please clear browser cache and refresh your website.

    Cheers!
    Andy

    #343295

    Hi Andy,

    thanks, centering works. But I can’t get Ismael’s code to work. Just to be sure we are talking about the same thing – what I want to achieve is that the placeholder text vanishes the moment I put the cursor in the input field. So far it only vanishes when I start typing a search query. I put the whole code at the end of my functions.php file, flushed the browser cache, reloaded, but it still doesn’t work. Maybe it is because of the search plugin code (use Swiftype to replace WP’s internal search function)?

    Best regards,
    Holger

    #344475

    Hi!

    Please remove the code then add this on Quick CSS or custom.css:

    #s:focus::-webkit-input-placeholder { color:transparent; }
    #s:focus:-moz-placeholder { color:transparent; }
    

    Regards,
    Ismael

    #344542

    Hi Ismael, thanks a lot. Now it works.

    Best regards,
    Holger

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Search box styling’ is closed to new replies.