• Resolved SaeedTJ

    (@saeedtj)


    hi everyone
    I just wanna put the search button without search bar and then you click on it, the search bar appears.
    I saw this method in lots of websites and demos but I wanna have it by my self.
    I searched but I couldn’t find the instruction.
    just help me if its possible for you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello Saeed.

    The Twenty Thirteen theme does this nicely.

    Use your inspector to view the focus states of the Twenty Thirteen search icon. Make note of the CSS used in its inactive state and its focused state.

    Copy and paste the input markup and CSS into your project.
    The Twenty Thirteen theme makes use of Genericon icon fonts.

    Example:

    <!-- markup -->
    <form role="search" method="get" class="search-form" action="https://yoursite.com/">
    <label>
    <span class="screen-reader-text">Search for:</span>
    <input type="search" class="search-field" placeholder="Search …" value="" name="s" title="Search for:">
    </label>
    <input type="submit" class="search-submit" value="Search">
    </form>

    And the CSS:

    .search-field {
        background-color: transparent;
        background-image: url(images/search-icon.png);
        background-position: 5px center;
        background-repeat: no-repeat;
        background-size: 24px 24px;
        border: none;
        cursor: pointer;
        height: 37px;
        margin: 3px 0;
        padding: 0 0 0 34px;
        position: relative;
        -webkit-transition: width 400ms ease, background 400ms ease;
        transition: width 400ms ease, background 400ms ease;
        width: 1px;
    }
    .search-field:focus {
        background-color: #fff;
        border: 2px solid #c3c0ab;
        cursor: text;
        outline: 0;
        width: 230px;
    }

    The main difference is the width property on click/focus state.

    Thread Starter SaeedTJ

    (@saeedtj)

    it worked really thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Q] How to Just show search button’ is closed to new replies.