TechQA.

CSS - make algolia autocomplete input wide as the input group

551 views Asked by Leff At 2017-08-27T11:55:39+00:00 27 August 2017 at 11:55 2025-12-22T04:29:13+00:00

I have a navbar built with Bootstrap v.4 and I have an algolia autocomplete search form in it.

<div class="container">
  <nav class="navbar navbar-toggleable-sm navbar-light bg-faded">
      <div class="menu-button">
        <div class="bar"></div>
        <div class="bar"></div>
        <div class="bar"></div>
      </div>

      <a href="{{ url('/') }}" class="logo-link">
        <img src="{{ asset('/img/logo-small-new.png') }}" alt="logo">
      </a>
      <div class="navbar-collapse collapse justify-content-between" id="navbar5">
          <form action="/search" method="get" class="my-auto d-inline mx-auto col-md-8" role="search">
              <div class="input-group">
                <span class="input-group-addon" id="basic-addon1">
                  <button type="submit" class="search-button">
                    <i class="ion-ios-search-strong"></i>
                  </button>
                </span>
                <input type="text" id="search-input" name="q" class="form-control aa-input-search" placeholder="Search for players and videos ..."  value="{{ Request::get('q') }}" aria-describedby="basic-addon1">
              </div>
          </form>
          <ul class="navbar-nav my-auto">
              @if (Auth::check())
              <li class="nav-item dropdown">
                  <a class="nav-link" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                      <i class="ion-ios-gear-outline"></i>
                  </a>
                  <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink">
                      <a class="dropdown-item" href="{{ url('/home') }}">Admin dashboard</a>
                      <a class="dropdown-item" href="{{ url('/logout') }}"
                          onclick="event.preventDefault();
                                   document.getElementById('logout-form').submit();">
                          Log out
                      </a>
                      <form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display: none;">
                          {{ csrf_field() }}
                      </form>
                  </div>
              </li>
              @else
              <li>
                <a href="{{ url('/login') }}" class="btn btn-outline-info">Sign in</a>
              </li>
              @endif
          </ul>
      </div>
  </nav>
</div>

The problem I have is that I have set the width of the search bar to a fixed width, in order to have the search form input visible, but then it doesn't look good on small screens, because it is not taking the same width as the parent element input group. This is the css:

.navbar {
  background: $white;
  .navbar-toggler {
    border: 0;
  }
  .btn {
    font-size: 14px;
  }

  .search-button {
    background: transparent;
    border: 0;
  }


  input {
    border: 0;
  }
  i {
    color: $green;
    font-size: 20px;
  }
  .input-group-addon {
    background: $white;
    border: 0;
    padding: 0;
  }
  @media (max-width: 767px) {
    input  {
      border-bottom: 1px solid $green;
    }
  }


  .aa-input-container {
    display: inline-block;
    position: relative; }
  .aa-input-search {
    width: 300px;
    padding: 12px 28px 12px 12px;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none; }
  .aa-input-search::-webkit-search-decoration, .aa-input-search::-webkit-search-cancel-button, .aa-input-search::-webkit-search-results-button, .aa-input-search::-webkit-search-results-decoration {
    display: none;
  }
  .input-group .form-control {
    width: 300px;
  }
}

Not sure how can I fix that so that I have the input same width as the input group. Here is the example of my case:

enter image description here

You can see by the border that the input is wider than the input group. How can I fix that?

html css algolia
Original Q&A
0

There are 0 answers

Related Questions in HTML

  • How to store a date/time in sqlite (or something similar to a date)
  • How to use custom font during html to pdf conversion?
  • Storing the preferred font-size in localStorage
  • mp4 embedded videos within github pages website not loading
  • Scrimba tutorial was working, suddenly stopped even trying the default
  • Is there any way to glow this bulb image like a real light bulb
  • With non-graphical maps in Leaflet, zoomDelta doesn't work
  • What can I do to improve my coding on both html and css
  • Uncaught TypeError: google.maps.LatLng is not a constructor at init (script.js:7:13)
  • Bootstrap modal not showing at the desired position on a web page when the screen size is smaller
  • Displaying a Movie List on a Website Using Jinja2 and Bootstrap
  • How to redirect to thank you page after submitting a Google form embedded into a Google Site?
  • Storing selected language in localStorage
  • Fences (parenthesis, braces) in HTML and MathML
  • Understanding Scroll Anchoring Behavoir

Related Questions in CSS

  • How to use custom font during html to pdf conversion?
  • Storing the preferred font-size in localStorage
  • mp4 embedded videos within github pages website not loading
  • Is there any way to glow this bulb image like a real light bulb
  • What can I do to improve my coding on both html and css
  • Uncaught TypeError: google.maps.LatLng is not a constructor at init (script.js:7:13)
  • Bootstrap modal not showing at the desired position on a web page when the screen size is smaller
  • How to increase quality of mathjax output?
  • Hover animation resetting( seemingly reverting back to original CSS and then again to hover)when moving mouse horizontaly accross a part of an element
  • Storing selected language in localStorage
  • How to clip grid cell and provide scroll as well?
  • KeyboardAvoidingView makes a messy the flexbox
  • Rotate an object around another object in javascript
  • Understanding Scroll Anchoring Behavoir
  • how to use only block layout in this css code?

Related Questions in ALGOLIA

  • useInfiniteHits react-instantsearch-core how to simply resetpage?
  • React InstantSearchNext, Next.js App Router
  • Secured API Key not extending filter of it's parent API Key for User-restricted access
  • How to build a full text semantic search engine using firestore in flutter
  • Applying Multiple Refinements with One Button Click
  • installing algolia plugin in medusajs backend store, gives an error
  • Algolia InstantSearch Swift Package Manager throws Compile error
  • Algolia Search Highlight in Tags not working NextJS
  • Couldn't get all the text for System-Wide search functionality using algolia-search-plugin with gatsby
  • How to do multiple search in react instanst search library?
  • Getting `ReferenceError: body is not defined` even though I can see the body in console log
  • Embed TypeScript project into JS one
  • Making a nested Firestore collection full-text-searchable with Algolia
  • How to stop AlgoliaSearchHelper .search() from revoking my numericRefinements
  • Algolia Highlight function for search results doesn't work

Popular Questions

  • How do I undo the most recent local commits in Git?
  • How can I remove a specific item from an array in JavaScript?
  • How do I delete a Git branch locally and remotely?
  • Find all files containing a specific text (string) on Linux?
  • How do I revert a Git repository to a previous commit?
  • How do I create an HTML button that acts like a link?
  • How do I check out a remote Git branch?
  • How do I force "git pull" to overwrite local files?
  • How do I list all files of a directory?
  • How to check whether a string contains a substring in JavaScript?
  • How do I redirect to another webpage?
  • How can I iterate over rows in a Pandas DataFrame?
  • How do I convert a String to an int in Java?
  • Does Python have a string 'contains' substring method?
  • How do I check if a string contains a specific word?

Trending Questions

  • UIImageView Frame Doesn't Reflect Constraints
  • Is it possible to use adb commands to click on a view by finding its ID?
  • How to create a new web character symbol recognizable by html/javascript?
  • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
  • Heap Gives Page Fault
  • Connect ffmpeg to Visual Studio 2008
  • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
  • How to avoid default initialization of objects in std::vector?
  • second argument of the command line arguments in a format other than char** argv or char* argv[]
  • How to improve efficiency of algorithm which generates next lexicographic permutation?
  • Navigating to the another actvity app getting crash in android
  • How to read the particular message format in android and store in sqlite database?
  • Resetting inventory status after order is cancelled
  • Efficiently compute powers of X in SSE/AVX
  • Insert into an external database using ajax and php : POST 500 (Internal Server Error)
  • Privacy
  • Terms
  • Cookies
  • Homegardensmart
  • Math
  • Aftereffectstemplates