The div display property in a media query

Below is the css styling for a specific div:

.titleHome {
    position: absolute;
    top: 10px;
    left: 12px;
    width: 80px;
    height: 50px;
    z-index: 8;
} 

My goal is to hide this div when the screen width exceeds 900px, and make it visible when the screen width is below 900px. I attempted the following media query, but it did not produce the desired result:

(start by changing css to have display: none;)
@media all and (max-width: 900px) {
    .titleHome { 
        display: normal; 
    }
}

After some trial and error, I found that if I keep the css as it is and use the following media query, it works as intended:

@media all and (max-width: 900px) {
    .titleHome { 
        display: none; 
    }
}

However, this achieves the opposite effect of what I want. How can I ensure the div disappears when the screen width is less than 900px?

Answer №1

Typical is not a suitable term. Please opt for block in this situation.

  @media all and (max-width: 900px) {
    .titleHome { 
        display: block; 
    }
 }

Answer №2

Replace max-width with min-width.

@media all and (min-width: 900px) {
    .pageTitle { 
        visibility: hidden; 
    }
}

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

What is the procedure for eliminating the underline located at the bottom of the table?

Can anyone please assist me with removing the underlines at the end of the table? I find it quite unattractive and can't seem to figure out how to remove it. https://i.sstatic.net/stvHt.png https://i.sstatic.net/YYbrX.png Below is the code snippet ...

choose a selection hopscotch

Is there a way to prevent the input field from jumping out of alignment when an option is selected in these q-select inputs? I want to fix this issue so that the field remains in line with the horizontal alignment. https://codepen.io/kiggs1881/pen/RwENYEX ...

Bootstrap Containers Misaligned

I have been developing a website with two containers, one on the left and one on the right. By executing the following HTML code, you can see the structure: <!DOCTYPE html> <html lang="en"> <head> <link rel=& ...

Issue with wrapper not aligning correctly at the top of the screen

I keep noticing a gap between my wrapper and the top of the page. Despite trying multiple solutions, none seem to work for me. The background image covers the entire background and is aligned at the top perfectly, but the wrapper with its own background a ...

Mastering VueTify: Customizing CSS like a Pro

Is there a way to modify the CSS of a child vuetify component? .filterOPV > div > div { min-height: 30px !important; } .filterOPV > div > div > div { background: #f5f5f5 !important; } <v-flex md2 class="filterOPV&quo ...

Footer div is being covered by the page

I am currently working on a website built with "WordPress", and I have implemented a mobile footer plugin that is designed to only appear on mobile devices. However, I am encountering an issue where the page content overlaps the footer on phones. I attemp ...

What is the process to replace the image in these templates?

I recently downloaded a template from the internet and am in the process of developing a website. Can someone please guide me on how to change the icons highlighted in the black and red boxes as shown in the image? I am using Visual Studio and ASP.NET fo ...

Achieving alignment between a button and input field using Bootstrap CSS

Struggling to align my buttons next to the inputs in my project, particularly due to my inexperience with bootstrap CSS and CSS in general. Could someone please point me in the right direction? Link to the issue Unfortunately, my Search and New buttons a ...

Using Jquery to toggle the visibility of divs based on radio button selections

I am struggling to hide the divs with the radio buttons until their title is clicked on. However, I am facing issues as they are not showing up when their title is clicked on. Any assistance would be greatly appreciated. SPIKE <!DOCTYPE html> &l ...

Issue with font selection on WordPress menu settingsI am having trouble getting my

Could someone please take a look at this? I am struggling to figure it out on my own. I am currently working on a website for a client and I have created a responsive menu. Unfortunately, the font style for the menu isn't working even though I have s ...

How can I create a single button to toggle the opening and closing of a div using this jquery code?

$(document).ready(function(){ $('#content1').hide(); $('a#openClose').click(function(){ if ($('#content1').is(':visible')) { $('#content1').hide(&apos ...

Adjust the code to enhance the functionality of web components in Sharepoint

I recently came across some code online that I'm trying to modify in order to add an expanding button next to a web part on my Sharepoint site. However, the problem is that by default, all web parts are already expanded and require a click to collapse ...

Changing the CSS class of a div using Shiny

One of the features in my Shiny app is a select menu which is represented in the code snippet below. selectInput( "mySelectMenu", "", c(1,2), selected = NULL, multiple = FALSE ) I have set up actions to be t ...

Customizing popups and tooltips in Material-UI charts

Has anyone had success with customizing the appearance of the popover/tooltip in mui charts? It seems like it should be a simple task, but despite searching extensively, I have only found information on formatting data and nothing about styling the CSS. ...

Adding the BETA symbol to your Bootstrap navbar is simple and can be done by

Is there a way to include a "BETA" symbol at the top of the "Brand Name" on my Navbar, similar to the "TM" symbol? How can this be achieved? ...

Vue-Router functions only on specific routes

While my vue-router correctly routes the URL for all menu buttons, it's not displaying each Vue component properly. You can see a demonstration here. Here is a snippet of my HTML (using Vuefy) <div class="navbar-start"> <a ...

What is the best way to position the left sidebar on top of the other components and shift them to the

Currently, I am working on a project to display NBA data fetched from an API. I am aiming to recreate the design showcased here: Dribbble Design My main challenge lies in overlaying the left sidebar onto the main box and shifting the components sligh ...

Tips for properly aligning blockquote opening and closing quotation marks

We are currently implementing custom styles for beginning and end quotes in a string using the <blockquote> tag. However, we are having issues with the alignment, as the opening quote appears before the text and the closing quote is at the end of the ...

Sequence of HTML elements arranged in a stack

Recently, I came across a useful jQuery tutorial called "jQuery for Absolute Beginners: Day 8". In this tutorial, there is an interesting code snippet that caught my attention: $(function() { $('.wrap').hover(function() { $(this).childre ...

Is it possible to adjust the font size in Bootstrap 4.6.2 to fit smaller fonts and bring back color to the tabs that were removed in the update?

While attempting to update Bootstrap from version 4.6.0 to 4.6.2 in a few codebases, I encountered some issues that prevented me from completing the upgrade successfully. The <small> tag and .small CSS class are now displaying larger than before. Ta ...