Troubleshooting a Responsive DIV with Hover Effects in CSS

I am encountering an issue with the mobile version of a responsive website that I am constructing.

The green "info" DIV seen at the top left corner in the full-screen version needs to be relocated and placed at the bottom of the screen, just above the footer DIV containing all the links, for the mobile version.

View the full-screen version here:

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

And this is the Mobile version:

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



This is the CSS for the regular full-screen layout:

#productHoverDIV {
   z-index: 20;

   position: absolute;
   top: 10px;
   left: 10px;

   width: 300px;

   padding: 8px;
}

Here's the mobile rule:

 @media screen and (max-width: 414px) {

  #productHoverDIV {
      z-index: 20;

      position: absolute;
      bottom: 40px; // height of the FOOTER DIV

      width: 100%;

      padding-top: 0px;
      padding-bottom: 0px;
  }
}

The problem lies in the fact that despite setting the productHoverDIV to be 40px from the bottom in the mobile layout, it still maintains its top:10px value from the standard CSS rule, resulting in covering most of the screen.
To resolve this, I need to somehow negate the top rule or replace it with a different value. However, determining the appropriate value for top is challenging as every mobile device has varying heights.

What steps should I take to address this issue?

Answer №1

It is recommended to revert back to the default value, which is auto. The redundant z-index and position values have been removed.

@media screen and (max-width: 414px) {

  #productHoverDIV {
      top: auto;
      bottom: 40px; 

      width: 100%;

      padding-top: 0px;
      padding-bottom: 0px;
  }
}

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

Change the color of the dropped div in fullcalendar

Here is the code for my customized calendar: $(renderTo).fullCalendar({ timeFormat: 'HH:mm', axisFormat: 'HH:mm', defaultView:view, firstHour: 7, firstDay: 1, titleFormat: { ...

Presenting XML data on a webpage using AJAX technology

I am currently working on setting up a web radio station with a program that allows streaming (jazler) to send xml files via ftp to a web server to automatically update information such as the current song playing and previous songs. The code for NowOnAir ...

Issues with Cross-Origin Resource Sharing (CORS) preventing successful communication with Rails application during POST

I'm trying to log into my app from a different domain. I've configured the server-side headers like so: application.rb: config.action_dispatch.default_headers = { 'Access-Control-Allow-Origin' => '*', 'Access-Cont ...

How to Make Bootstrap 3 Collapse Panels Stand Out with an Active Class

First of all, here is the fiddle link: http://jsfiddle.net/krish7878/h38jn324 I have a simple question. When a panel is clicked and it expands to show its contents, a class 'active' should be added to 'panel-heading'. I came across a ...

Ways to customize the default CSS styles of angularJS for elements like search box and more

Looking for a way to customize the appearance of an AngularJs search box? <div ng-controller="PersonListCtrl"> <div class="bar">Search: <input ng-model="query"> </div> <ul cl ...

What steps should I follow to ensure that the "-> comes after the text?

Here is the link to my page: . Currently, the arrow appears under the text. I am looking for a way to rearrange it so that the arrow comes after the text while still maintaining its hover effect. Can you provide any suggestions? ...

Can images be placed on the border?

Hi there! I am trying to add an image on a border with a 100px solid width using CSS. I have experimented with positions and z-index, but I can't seem to get the desired effect. Any ideas on how to achieve this? Here is an example image: https://i.sst ...

Utilizing ScrollTo() in Javascript will smoothly navigate the page downward

Within my HTML Document, there lies an input field where you can enter a numerical value, and the window should automatically scroll to that specific pixel number. To achieve this, I utilized the scrollTo() function. However, I encountered an issue where ...

From Spring MVC to JSON data output

I have a JAVA EE backend and I am using Spring MVC. Currently, I have an AJAX call set up as follows: function getAllProjects() { $.getJSON("project/getall", function(allProjects) { ??? }); } In my backend system: @Reques ...

Expanding the width of horizontal checkboxes to 100% using jQuery Mobile

I'm attempting to expand three horizontal checkboxes across the entire width of the page. <!DOCTYPE html> <html> <head> <title>My Page</title> <meta name="viewport" content="width=device-width, initial-s ...

Retrieve the video URL from Facebook within a WebView

Is there a way to download videos from Facebook using the video URL obtained from a Webview? I have attempted different methods to achieve this without success. 1.Link 1 2.Link 2 I tried extracting the video tag from the HTML in the Webview, however, cl ...

Stopping the setInterval with jQuery: A guide for beginners

I have a drop-down menu where I can choose the interval time for the setInterval. example.php: <select id="proc_id" class="multiselect custom processselect" name="proc_id" style="display: none;"> <option>Select</option> <opti ...

Enhance the appearance of 6 image URLs by wrapping them in dynamic divs with the

Can someone assist me in displaying 6 images retrieved from a MySQL database on an MVC Razor view? Images 1 and 6 should be placed in separate divs labeled "item", while images 2, 3, 4, and 5 should be grouped together in a div called "item-small". Below i ...

blurred image effect on bootstrap card hover

My attempt to create a blurred image effect on a bootstrap card hover is not working as expected. The blur effect works fine without the hover. Here is the code I have been using: .card-img { transition: all 1s ease; -webkit-filter: blur(0px); ...

Adjust the hover link color of the Bootstrap 4 navbar

Seeking tips on how to change link color when hovering over it. Appreciate any advice! HTML: <nav> <a class="underline" href="welcome.html">./home </a> <a class="underline" href="about.html" ...

Is it possible to edit the HTML DOM of an external URL that is opened using window.open?

Imagine a scenario where I have a page located at: www.mydomain.com When a user clicks on a button, it triggers the opening of a new window using: newWin = window.open("https://www.otherdomain.com","a","height=800,width=1000"); Now, my objective is to m ...

The use of absolute positioning in conjunction with overflow:hidden

<div id="container" style="overflow:hidden; position:relative;"> <div id="content" style="position:absolute;"> </div> </div> Is it possible to display the content element which is larger than its parent container, while still k ...

arrange objects into an array depending on punctuation marks

Currently, I am in the process of developing a method to retrieve data from my MySQL database and present it as an array. However, the issue I am facing is that only one string of data is accessible at a time, with each instance separated by a comma. For e ...

What is the best way to retrieve the content of a specific class in Selenium WebDriver?

Python Code : from selenium import webdriver from selenium.webdriver.chrome.options import Options options = webdriver.ChromeOptions() options.add_argument(r"--user-data-dir=C:\Users\bji\AppData\Local\Google\Chrome\ ...

Tips for showcasing chats with the most recent message highlighted

As I work on my web app using Laravel, I have encountered an issue where I need to scroll down to see the newest messages when there are many conversations. Here is how the chats display on page load I want to focus on displaying the newest message first. ...