Trouble getting custom CSS media queries to function properly alongside Bootstrap 3

I've encountered an issue while using bootstrap 3 with jquery UI to implement search and select fields for the user. The CSS code seems to be working fine on larger screens, but it's completely non-functional on smaller screens. I tried applying a media query code to address this problem, but unfortunately, it didn't have any effect. Upon further investigation, I realized that my custom CSS code isn't being applied with any @media queries. Since I'm utilizing bootstrap3 throughout the website, I'm seeking suggestions or solutions to resolve this issue. Any insights or ideas would be greatly appreciated!

@media only screen and (max-width: 500px) {
    .ui-autocomplete {
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 1000;
        float: left;
        display: none;
        min-width: 160px;   
        padding: 4px 0;
        margin: 0 0 10px 25px;
        list-style: none;
        background-color: #ffffff;
        border-color: #ccc;
        border-color: rgba(0, 0, 0, 0.2);
        border-style: solid;
        border-width: 1px;
        -webkit-border-radius: 5px;
        -moz-border-radius: 5px;
        border-radius: 5px;
        -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
        -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
        -webkit-background-clip: padding-box;
        -moz-background-clip: padding;
        background-clip: padding-box;
        *border-right-width: 2px;
        *border-bottom-width: 2px;
    }

.ui-menu-item > a.ui-corner-all {
        display: block;
        padding: 3px 15px;
        clear: both;
        font-weight: normal;
        line-height: 18px;
        color: #555555;
        white-space: nowrap;
        text-decoration: none;
    }

.ui-state-hover, .ui-state-active {
        color: #ffffff;
        text-decoration: none;
        background-color: #0088cc;
        border-radius: 0px;
        -webkit-border-radius: 0px;
        -moz-border-radius: 0px;
        background-image: none;
    } 

    }

Answer №1

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        body{
            background:blue;
        }
        @media only screen and (max-width: 600px) {
            body{
                background:yellow;
            }
        }
    </style>
</head>
<body>

</body>
</html>

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

Allowance for text overflow on subsequent line

Below is the snippet of HTML code I am working with: <h4 class="clickbelow">This is a very long line that overflows onto a new line when the width is small.</h4> Here is the CSS that I have implemented: .clickbelow:before { content: url( ...

Error message: "Invalid syntax detected while using the jQuery UI select plugin"

While utilizing jquery 1.8.1, I encountered a particular error message related to the jquery ui select plugin within the second code snippet. The specific error is shown below: Uncaught Error: Syntax error, unrecognized expression: li:not(.ui-selectmenu-g ...

The use of JQuery datatables and the impact on data loading speed

, I have incorporated JQuery datatable to showcase all the projects stored in my database: <script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $('table.display').dataTable({ "bJQueryUI": tr ...

Incorporate videos from platforms like Youtube, Vimeo, and more

I am looking to add videos to my website without hosting them on my server. I want the flexibility to use links from any source, not just YouTube or Vimeo. Is there a way to achieve this using something similar to an iframe? <iframe width="560" heigh ...

Tips for customizing the appearance of a chosen radio button

Here is my HTML code snippet: <div class="col-md-12 money-radio-container"> <input type="radio" name="optradio" class="money-radio" value="10">10 <span>$</span> <input type="radio" name="optradio" class="money-radio" val ...

How can I set a value using document.getElementById(idPopUPImage).innerHTML to create a static popup in Leaflet?

I added a leaflet map to my project which you can find on Codpen In the map, I've included a button key that displays an image in a popup when clicked. However, after closing the popup and reopening it, the image doesn't show unless I click the ...

Tips for aligning pagination block at the center using react-bootstrap

Currently, I have implemented a custom pagination system for a small web application that I am developing using react-bootstrap. I have successfully integrated and set up the pagination functionality. As someone who is still new to react and bootstrap, wit ...

Update the iframe URL to direct the user to a new tab instead of opening a popup

I have created the following script, but I am facing a challenge as I realize that the URL I want to use opens in a new tab instead of just forwarding: <script> function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.sp ...

Issues with the aligning of buttons using the justify-content property

The issue I'm facing involves a parent container with 3 buttons nested inside. The parent container is set to display:inline-flex, however, the justify-content: space-between property is not behaving as expected. Each button has a defined max-width in ...

Having trouble with my bootstrap slider carousel - it's just not cooperating

I incorporated Bootstrap's carousel to display the various courses on my website, featuring three courses at a time before transitioning to the next set of three. However, I am encountering an issue with this setup. Please see the image below for refe ...

Successful jQuery Ajax request made without the need for JSON parsing

I find it strange that my experience with jQuery's ajax function is completely different from what I'm used to. Below is the javascript code in question: $.ajax({ url: "/myService.svc/DoAction", type: "GET", dataType: "json", su ...

The Bootstrap grid column remains steady and does not fluctuate

Trying to get a grasp on Bootstrap 4, I've set up my page with a three-column layout and defined the following properties for each column: Column 1: col-sm-9 col-md-8 Column 2: col-sm-3 col-md-2 order-sm-first Column 3: col-xs-12 col-md-2 My expecta ...

The CSS overflow scroller trims the excess background color

Attempting to build a website, I encountered an issue with displaying a scroll bar. Despite using the CSS property overflow: auto, I faced another problem. Let me illustrate the issue through a simple example. I have an outer div with the style overflow: ...

Using jQuery's .each() method to iterate over a JSON object may only display the

Running into some trouble with jQuery.each(). I'm pulling JSON data from another PHP file and trying to display a specific key value from it. This is the JavaScript code I have: <div class="row" id="fetchmember"> <script type="text/javasc ...

Using an ampersand in my XML code is preventing it from being loaded correctly using jQuery

I am currently facing an issue with displaying descriptions within an XML document and loading it into my application using jQuery. Whenever I attempt to include '&' in the code, it causes a breakage during loading. I have also tried &# ...

Ways to disable HTML loading prior to CSS loading

After downloading a site template, I observed that the HTML is loaded first before the CSS. Is there a way to disable this? I am looking to create a preloader for the website. ...

Navigating Bootstrap 5 & Sass in Visual Studio 2019: A Comprehensive Guide

I recently added Install-Package bootstrap.sass to my ASP .net core 3.1 project. After installation, I noticed that it included both the bootstrap.js and scss folder. However, I'm unsure of how to compile the bootrap.scss file and implement it in the ...

Styling a layout with two columns, centered with an offset

I have created a layout with two columns - one on the left and one on the right, with the left column containing two rows. However, I am looking to offset the center point of the column to the right so that the left column occupies about 60% of the space ...

What is the best way to shorten a text using ellipses based on character count, rather than line breaks

If I have a text that needs to be trimmed down to 15 characters, like "I want to trim this text into 15 characters for example," the result should be something like "I want to limit..." in my email template. Is there a way to achieve this using just CSS? ...

Select a division and retrieve the identification of a different division

I am looking to trigger an event by clicking on one element and extracting the ID from a separate, unrelated div. Here is my attempt: $(".map_flag").on("click",function(){ var selectedID = ($(this).attr("data_modal")); $("#" + selectedID).fade ...