Set the search input to occupy the full width of the container by utilizing Bootstrap's

I'm having trouble adjusting the width of my search input to 100% on screen resize (using @media (max-width: 1200px)). The issue:

https://i.sstatic.net/EMr6W.jpg

Here's how it should look (I can achieve this with a specific pixel width, but not dynamically):

https://i.sstatic.net/JrmVQ.png

index.html file:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>MONI BAU</title>
<link rel="icon" href="Fotot/icon.png">
<link href="Css/bootstrap.css" rel="stylesheet">
<link rel="stylesheet" href="Css/style.css">
</head>
<body>
<div class="container">
<nav class="navbar navbar-default">

        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#mainNavBar">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a href="#" class="navbar-brand"><img src="Fotot/logo.png" width="200px"></a>
        </div>
        <div class="collapse navbar-collapse" id="mainNavBar">
            <div class="paddingSearch navbar-right">
                <form class="navbar-form" role="search">
                    <div class="input-group">
                        <input type="text" class="form-control" placeholder="Kërko" name="q">
                            <div class="input-group-btn">
                                <button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
                            </div>
                    </div>
                </form>
            </div>              
            <ul class="nav navbar-nav navbar-right paddingSearch">
                <li><a href="#"><i class="glyphicon glyphicon-home">     </i>Kryefaqja</a></li>
                <li><a href="#"><i class="glyphicon glyphicon-wrench"></i>Produktet</a></li>
                <li><a href="#"><i class="glyphicon glyphicon-envelope"></i>Kontakt</a></li>
                <li><a href="#"><i class="glyphicon glyphicon-user"></i>Për Ne</a></li>
            </ul>
        </div>
</nav>
</div>

<script src="http://code.jquery.com/jquery-1.12.0.min.js"></script>
<script type="text/javascript" src="JS/bootstrap.min.js"></script>
</body>
</html>

and my custom style.css:

body{
background-image: url(../Fotot/background.png);
margin: 0;
padding: 0;
font-family: Century Gothic,CenturyGothic,AppleGothic,sans-serif; 
}
.navbar-brand {
height: 80px;
}
.paddingSearch
{   
padding-top: 15px;
padding-bottom:15px;
margin: 0;  
color: #1a0000;  
font-size: 12pt;
}
.paddingSearch i{
color: black;
width: 20px;
}   
.navbar-toggle {
padding: 10px;
margin: 25px 15px 25px 0;
}
.navbar-brand {
display: flex;
align-items: center;
}

@media (max-width: 1200px) {
.navbar-header {
    float: none;
}
.navbar-left,.navbar-right {
    float: none !important;
}
.navbar-toggle {
    display: block;
}
.navbar-collapse {
    border-top: 1px solid transparent;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
    top: 0;
    border-width: 0 0 1px;
}
.navbar-collapse.collapse {
    display: none!important;
}
.navbar-nav {
    float: none!important;
    margin-top: 7.5px;
}
.navbar-nav>li {
    float: none;
}
.navbar-nav>li>a {
    padding-top: 10px;
    padding-bottom: 10px;
}
.collapse.in{
    display:block !important;
}
.navbar-nav .open .dropdown-menu {
   position: static;
   float: none;
   width: auto;
   margin-top: 0;
   background-color: transparent;
   border: 0;
   -webkit-box-shadow: none;
   box-shadow: none;
}
}

Answer №1

UPDATE: Adjust the media query to @media (min-width: 1200px) rather than using max-width.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How can I use AJAX to remove a record from a MySQL table?

I am looking to create a button with an image X that, when clicked, will delete a row from the database at that exact moment. teste-checkbox.php <style> table { font-family: verdana; font-size: 12px; } table th { text-align: left; backgrou ...

Following an AJAX request, jQuery.each() does not have access to the newly loaded CSS selectors

Note: While I value the opinions of others, I don't believe this issue is a duplicate based on the provided link. I have searched for a solution but have not found one that addresses my specific problem. Objective: Load HTML content to an element u ...

What is the best way to arrange an unordered list in a horizontal layout?

I have four lists that I want to display side by side. The first row should show a Doctor and Patient side by side, the second row should show a Pharma Company and Employee side by side. However, in my code, this layout is not working as intended. .tree ...

Interactive YouTube Video Player that keeps video playing in original spot upon clicking the button

Currently, I'm working on a project that involves combining navigation and a video player within the same div container. Here is an image link And another image link The concept is that when you click on one of the four boxes, a new video will appe ...

Setting column heights and spacing in Bootstrap

I'm looking to dynamically populate the blocks. Essentially, a for loop would be used to pass the data. However, I'm facing some challenges with the height of the blocks at different screen sizes while utilizing bootstrap 4. My goal is to have th ...

Add CSS properties to child elements that are not of a specific selector, while styling their descendants without any restrictions

Seeking assistance for an Angular application, but the query also pertains to CSS principles in general. In my Angular project, I have a main component containing several child components, all with standard view encapsulation. Specifically, I am looking t ...

Replicate and $(document).ready()

My form has required fields that need to be completed. To alert users about blank fields, I have implemented the following code: $(document).ready(function() { $('input.required:text').focus(function() { $(this).css({'background ...

Guide to placing a button on the same line as text with the use of JavaScript

Does anyone know how to add a button to the right of text that was added using JS DOM? I've tried multiple techniques but can't seem to get it right - the button always ends up on the next line. Any tips on how to achieve this? var text = docu ...

Ways to adjust the dimensions of a division element using Bootstrap

I have a CSS class called "brands" and I am looking to change the size of the thumbnail div within this brand class. How can I go about doing this? <div class="brands"> <div class="row"> <?php foreach ($item['brands'] ...

Issues with Ul List Alignment (CSS and HTML)

<div class="companies"> <ul class="logos"> <li><img src="images/image1.png" alt="" height="25px" /></li> <li><img src="images/image2.png" alt="" height="25px" /></li> <li> ...

I'm not sure why, but for some strange reason, Markdown images refuse to display when surrounded by

Recently, I've encountered a strange issue where my markdown image tag doesn't display the image when wrapped in a <div> or a <section>. Instead, it just outputs markdown code. Take a look at this screenshot for reference. <sectio ...

Change the x and y positions of several div elements as the mouse moves in JavaScript

I am aiming to create a webpage where multiple divs with text and other content move along the x and y axes of the mouse. The desired effect is similar to parallax scrolling, but I have found that existing parallax plugins are image-based and do not work w ...

Chrome is not storing the CSS file in its cache memory. However, it is successfully caching .js and .png

I have noticed that the CSS file is not being cached in the Chrome browser. My application is created using Angular-CLI and all the necessary cache-control headers are set, with an Expires header of 5 minutes: Accept-Ranges:bytes Cache-Control:max-age=600 ...

Error: Identical div IDs detected

<div id="tagTree1" class="span-6 border" style='width:280px;height:400px;overflow:auto;float:left;margin:10px; '> <a class="tabheader" style="font-size:large">Data Type</a><br /> <div class="pane">Refine sea ...

Convert and transfer CSS image data encoded in Base-64 to Asp.Net MVC/WebApi

Regarding the query. I successfully displayed a base-64 encoded image on the client side. .even { background: #fff url(data:image/gif;base64,R0lGODlhBgASALMAAOfn5+rq6uvr6+zs7O7u7vHx8fPz8/b29vj4+P39/f///wAAAAAAAAAAAAAAAAAAACwAAAAABgASAAAIMAAVCBxIsKDBgwgTDk ...

What is the best way to dynamically render classes based on conditions in a table using React Bootstrap?

I am looking for a way to dynamically change the color of a class based on the transaction data in a table. import React from "react"; import Table from "react-bootstrap/Table"; import "./TableComponent.css"; const TableComponent = ({ Movement }) =&g ...

How can the target pseudo-class be utilized to replace the 'active' state on navigation across several pages effectively?

Within a large application, I am managing a micro site and looking to implement tertiary navigation with an active state for pages. This involves inserting a single html blob into multiple pages. My goal is to use an active class to highlight the page in ...

Utilize XQuery to manipulate both outer elements and inner elements

As a newcomer to XQuery, I am seeking assistance with the following XML example: <lg> <l n="1">Z nutz vnd heylsamer ler / verma⸗ </l> <l n="2">nung vnd ervolgung der wyßheit / ver </l> <l n="3"> ...

Animating lines with JQuery beneath navigation links

Currently in the process of revamping my portfolio website, and it's still a work in progress. Recently stumbled upon a jquery tutorial that enables a line to animate under anchor elements on hover, which I find quite intriguing. However, I am facing ...

Is the condition failing to evaluate for all td elements?

I am currently dealing with an HTML table. When I select a checkbox, I aim to compare the values of the cells in each row. This comparison works correctly for the first row, but it does not work for any subsequent rows. HTML Code - <form role="fo ...